Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753179Ab1CMFeG (ORCPT ); Sun, 13 Mar 2011 00:34:06 -0500 Received: from mail-qw0-f46.google.com ([209.85.216.46]:50490 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543Ab1CMF3r (ORCPT ); Sun, 13 Mar 2011 00:29:47 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=xAVYL+bnBkPQtp8sWnfVtXEAus6w3v+OvPJbzSzrZxTFAeRptDU+ynCAGRgVDLN2Nq mZ316CH2VRsMAFGYv6Zq/1O+Qs9vzxcKzENNwrg0OKH2Xk9jjM515AXgvQ+K+qye19sl aT1BBOBh87VePYorohu2RrAWXGwOgG6v6AUuQ= From: Ilia Mirkin To: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/24] staging: rtl8192u: Remove NULL check before kfree Date: Sun, 13 Mar 2011 00:29:07 -0500 Message-Id: <1299994157-11191-15-git-send-email-imirkin@alum.mit.edu> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1299994157-11191-14-git-send-email-imirkin@alum.mit.edu> References: <20110222145452.GD1331@suse.de> <1299994157-11191-1-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-2-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-3-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-4-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-5-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-6-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-7-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-8-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-9-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-10-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-11-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-12-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-13-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-14-git-send-email-imirkin@alum.mit.edu> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5783 Lines: 186 This patch was generated by the following semantic patch: // @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // Signed-off-by: Ilia Mirkin --- drivers/staging/rtl8192u/ieee80211/cipher.c | 3 +- .../staging/rtl8192u/ieee80211/ieee80211_module.c | 7 +--- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 7 +--- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 7 +--- drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 1 - drivers/staging/rtl8192u/r8192U_core.c | 39 ++++++-------------- 6 files changed, 19 insertions(+), 45 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/cipher.c b/drivers/staging/rtl8192u/ieee80211/cipher.c index 0b9e8a4..69dcc31 100644 --- a/drivers/staging/rtl8192u/ieee80211/cipher.c +++ b/drivers/staging/rtl8192u/ieee80211/cipher.c @@ -294,6 +294,5 @@ out: void crypto_exit_cipher_ops(struct crypto_tfm *tfm) { - if (tfm->crt_cipher.cit_iv) - kfree(tfm->crt_cipher.cit_iv); + kfree(tfm->crt_cipher.cit_iv); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 7455264..fe978f3 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -198,11 +198,8 @@ void free_ieee80211(struct net_device *dev) int i; //struct list_head *p, *q; // del_timer_sync(&ieee->SwBwTimer); - if (ieee->pHTInfo != NULL) - { - kfree(ieee->pHTInfo); - ieee->pHTInfo = NULL; - } + kfree(ieee->pHTInfo); + ieee->pHTInfo = NULL; RemoveAllTS(ieee); ieee80211_softmac_free(ieee); del_timer_sync(&ieee->crypt_deinit_timer); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 1ea8da3..498b520 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1384,11 +1384,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, return 1; rx_dropped: - if (rxb != NULL) - { - kfree(rxb); - rxb = NULL; - } + kfree(rxb); + rxb = NULL; stats->rx_dropped++; /* Returning 0 indicates to caller that we have not handled the SKB-- diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 20f8c34..4992d63 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2755,11 +2755,8 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) void ieee80211_softmac_free(struct ieee80211_device *ieee) { down(&ieee->wx_sem); - if(NULL != ieee->pDot11dInfo) - { - kfree(ieee->pDot11dInfo); - ieee->pDot11dInfo = NULL; - } + kfree(ieee->pDot11dInfo); + ieee->pDot11dInfo = NULL; del_timer_sync(&ieee->associate_timer); cancel_delayed_work(&ieee->associate_retry_wq); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index d6f55c2..f0ba7f4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -855,7 +855,6 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) ieee->wpa_ie_len = len; } else{ - if (ieee->wpa_ie) kfree(ieee->wpa_ie); ieee->wpa_ie = NULL; ieee->wpa_ie_len = 0; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index ae4f2b9..da612e6 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2242,12 +2242,8 @@ short rtl8192_usb_initendpoints(struct net_device *dev) destroy: - if (priv->pp_rxskb) { - kfree(priv->pp_rxskb); - } - if (priv->rx_urb) { - kfree(priv->rx_urb); - } + kfree(priv->pp_rxskb); + kfree(priv->rx_urb); priv->pp_rxskb = NULL; priv->rx_urb = NULL; @@ -2276,10 +2272,8 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) kfree(priv->rx_urb); priv->rx_urb = NULL; } - if(priv->oldaddr){ - kfree(priv->oldaddr); - priv->oldaddr = NULL; - } + kfree(priv->oldaddr); + priv->oldaddr = NULL; if (priv->pp_rxskb) { kfree(priv->pp_rxskb); priv->pp_rxskb = 0; @@ -2304,14 +2298,10 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) } #else - if(priv->rx_urb){ - kfree(priv->rx_urb); - priv->rx_urb = NULL; - } - if(priv->oldaddr){ - kfree(priv->oldaddr); - priv->oldaddr = NULL; - } + kfree(priv->rx_urb); + priv->rx_urb = NULL; + kfree(priv->oldaddr); + priv->oldaddr = NULL; if (priv->pp_rxskb) { kfree(priv->pp_rxskb); priv->pp_rxskb = 0; @@ -5828,10 +5818,8 @@ static int __devinit rtl8192_usb_probe(struct usb_interface *intf, fail2: rtl8192_down(dev); - if (priv->pFirmware) { - kfree(priv->pFirmware); - priv->pFirmware = NULL; - } + kfree(priv->pFirmware); + priv->pFirmware = NULL; rtl8192_usb_deleteendpoints(dev); destroy_workqueue(priv->priv_wq); mdelay(10); @@ -5869,11 +5857,8 @@ static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf) rtl8192_proc_remove_one(dev); rtl8192_down(dev); - if (priv->pFirmware) - { - kfree(priv->pFirmware); - priv->pFirmware = NULL; - } + kfree(priv->pFirmware); + priv->pFirmware = NULL; // priv->rf_close(dev); // rtl8192_SetRFPowerState(dev, eRfOff); rtl8192_usb_deleteendpoints(dev); -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/