This patch was generated by the following semantic patch: // <smpl> @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // </smpl> (And there was one instance in bcm/CmHost.c where I removed the NULL assignment since that variable was getting immediately reassigned.) Signed-off-by: Ilia Mirkin <imirkin@xxxxxxxxxxxx> --- drivers/staging/ath6kl/os/linux/ar6k_pal.c | 6 +-- drivers/staging/ath6kl/os/linux/hci_bridge.c | 6 +-- drivers/staging/bcm/CmHost.c | 6 +-- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 6 +-- drivers/staging/brcm80211/brcmsmac/wlc_alloc.c | 41 +++++++------------- drivers/staging/brcm80211/brcmsmac/wlc_bmac.c | 6 +-- drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c | 12 ++---- drivers/staging/comedi/drivers/usbdux.c | 8 +--- drivers/staging/cx25821/cx25821-audio-upstream.c | 6 +-- .../staging/cx25821/cx25821-video-upstream-ch2.c | 6 +-- drivers/staging/cx25821/cx25821-video-upstream.c | 6 +-- drivers/staging/keucr/ms.c | 14 ++----- .../staging/rtl8192e/ieee80211/ieee80211_module.c | 7 +-- drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c | 7 +-- .../staging/rtl8192e/ieee80211/ieee80211_softmac.c | 7 +-- .../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/r8192U_core.c | 31 +++++---------- drivers/staging/speakup/main.c | 6 +-- drivers/staging/wlan-ng/hfa384x_usb.c | 6 +-- 21 files changed, 65 insertions(+), 143 deletions(-) diff --git a/drivers/staging/ath6kl/os/linux/ar6k_pal.c b/drivers/staging/ath6kl/os/linux/ar6k_pal.c index 831b2e3..34d4dc9 100644 --- a/drivers/staging/ath6kl/os/linux/ar6k_pal.c +++ b/drivers/staging/ath6kl/os/linux/ar6k_pal.c @@ -260,10 +260,8 @@ static void bt_cleanup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo) } } - if (pHciPalInfo->hdev != NULL) { - kfree(pHciPalInfo->hdev); - pHciPalInfo->hdev = NULL; - } + kfree(pHciPalInfo->hdev); + pHciPalInfo->hdev = NULL; } /********************************************************* diff --git a/drivers/staging/ath6kl/os/linux/hci_bridge.c b/drivers/staging/ath6kl/os/linux/hci_bridge.c index f170382..3c886f3 100644 --- a/drivers/staging/ath6kl/os/linux/hci_bridge.c +++ b/drivers/staging/ath6kl/os/linux/hci_bridge.c @@ -929,10 +929,8 @@ static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) } } - if (pHcidevInfo->pBtStackHCIDev != NULL) { - kfree(pHcidevInfo->pBtStackHCIDev); - pHcidevInfo->pBtStackHCIDev = NULL; - } + kfree(pHcidevInfo->pBtStackHCIDev); + pHcidevInfo->pBtStackHCIDev = NULL; } static int bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 5ac4582..51d37b0 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -974,11 +974,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A !(psfLocalSet->u8RequesttransmissionPolicy & MASK_DISABLE_HEADER_SUPPRESSION); - if(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication) - { - kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication); - Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = NULL; - } + kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication); Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication; //Re Sort the SF list in PackInfo according to Traffic Priority diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c index 061cc82..a2751ff 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c @@ -5568,10 +5568,8 @@ static void dhdsdio_release_malloc(dhd_bus_t *bus, struct osl_info *osh) bus->rxlen = 0; } - if (bus->databuf) { - kfree(bus->databuf); - bus->databuf = NULL; - } + kfree(bus->databuf); + bus->databuf = NULL; } static void dhdsdio_release_dongle(dhd_bus_t *bus, struct osl_info *osh) diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_alloc.c b/drivers/staging/brcm80211/brcmsmac/wlc_alloc.c index b7934ed..9e1adcd 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_alloc.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_alloc.c @@ -140,10 +140,8 @@ void wlc_bsscfg_mfree(struct osl_info *osh, wlc_bsscfg_t *cfg) if (cfg == NULL) return; - if (cfg->maclist) { - kfree(cfg->maclist); - cfg->maclist = NULL; - } + kfree(cfg->maclist); + cfg->maclist = NULL; if (cfg->current_bss != NULL) { wlc_bss_info_t *current_bss = cfg->current_bss; @@ -306,15 +304,11 @@ void wlc_detach_mfree(struct wlc_info *wlc, struct osl_info *osh) if (wlc == NULL) return; - if (wlc->modulecb) { - kfree(wlc->modulecb); - wlc->modulecb = NULL; - } + kfree(wlc->modulecb); + wlc->modulecb = NULL; - if (wlc->default_bss) { - kfree(wlc->default_bss); - wlc->default_bss = NULL; - } + kfree(wlc->default_bss); + wlc->default_bss = NULL; if (wlc->cfg) { wlc_bsscfg_mfree(osh, wlc->cfg); wlc->cfg = NULL; @@ -326,22 +320,17 @@ void wlc_detach_mfree(struct wlc_info *wlc, struct osl_info *osh) } kfree(wlc->wsec_def_keys[0]); - if (wlc->protection) { - kfree(wlc->protection); - wlc->protection = NULL; - } + kfree(wlc->protection); + wlc->protection = NULL; - if (wlc->stf) { - kfree(wlc->stf); - wlc->stf = NULL; - } + kfree(wlc->stf); + wlc->stf = NULL; kfree(wlc->bandstate[0]); if (wlc->corestate) { - if (wlc->corestate->macstat_snapshot) { - kfree(wlc->corestate->macstat_snapshot); wlc->corestate->macstat_snapshot = NULL; - } + kfree(wlc->corestate->macstat_snapshot); + wlc->corestate->macstat_snapshot = NULL; kfree(wlc->corestate); wlc->corestate = NULL; } @@ -353,10 +342,8 @@ void wlc_detach_mfree(struct wlc_info *wlc, struct osl_info *osh) } if (wlc->hw) { - if (wlc->hw->bandstate[0]) { - kfree(wlc->hw->bandstate[0]); - wlc->hw->bandstate[0] = NULL; - } + kfree(wlc->hw->bandstate[0]); + wlc->hw->bandstate[0] = NULL; /* free hw struct */ kfree(wlc->hw); diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c index ac068cd..7aeddaf 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c @@ -1045,10 +1045,8 @@ int wlc_bmac_detach(struct wlc_info *wlc) wlc_phy_shim_detach(wlc_hw->physhim); /* free vars */ - if (wlc_hw->vars) { - kfree(wlc_hw->vars); - wlc_hw->vars = NULL; - } + kfree(wlc_hw->vars); + wlc_hw->vars = NULL; if (wlc_hw->sih) { si_detach(wlc_hw->sih); diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c index 91a2de2..0c3f791 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c @@ -2175,10 +2175,8 @@ uint wlc_detach(struct wlc_info *wlc) #ifdef BCMDBG - if (wlc->country_ie_override) { - kfree(wlc->country_ie_override); - wlc->country_ie_override = NULL; - } + kfree(wlc->country_ie_override); + wlc->country_ie_override = NULL; #endif /* BCMDBG */ { @@ -8024,10 +8022,8 @@ static void wlc_process_eventq(void *arg) while ((etmp = wlc_eventq_deq(wlc->eventq))) { /* Perform OS specific event processing */ wl_event(wlc->wl, etmp->event.ifname, etmp); - if (etmp->data) { - kfree(etmp->data); - etmp->data = NULL; - } + kfree(etmp->data); + etmp->data = NULL; wlc_event_free(wlc->eventq, etmp); } } diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 696ee04..be93c30 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2265,12 +2265,8 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) usbduxsub_unlink_OutURBs(usbduxsub_tmp); } for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { - if (usbduxsub_tmp->urbOut[i]->transfer_buffer) { - kfree(usbduxsub_tmp-> - urbOut[i]->transfer_buffer); - usbduxsub_tmp->urbOut[i]->transfer_buffer = - NULL; - } + kfree(usbduxsub_tmp->urbOut[i]->transfer_buffer); + usbduxsub_tmp->urbOut[i]->transfer_buffer = NULL; if (usbduxsub_tmp->urbOut[i]) { usb_kill_urb(usbduxsub_tmp->urbOut[i]); usb_free_urb(usbduxsub_tmp->urbOut[i]); diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c index be657df..0f9ca77 100644 --- a/drivers/staging/cx25821/cx25821-audio-upstream.c +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c @@ -244,10 +244,8 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) dev->_audioframe_count = 0; dev->_audiofile_status = END_OF_FILE; - if (dev->_irq_audio_queues) { - kfree(dev->_irq_audio_queues); - dev->_irq_audio_queues = NULL; - } + kfree(dev->_irq_audio_queues); + dev->_irq_audio_queues = NULL; kfree(dev->_audiofilename); } diff --git a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c index 586739d..655357d 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c +++ b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c @@ -234,10 +234,8 @@ void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev) dev->_frame_count_ch2 = 0; dev->_file_status_ch2 = END_OF_FILE; - if (dev->_irq_queues_ch2) { - kfree(dev->_irq_queues_ch2); - dev->_irq_queues_ch2 = NULL; - } + kfree(dev->_irq_queues_ch2); + dev->_irq_queues_ch2 = NULL; kfree(dev->_filename_ch2); diff --git a/drivers/staging/cx25821/cx25821-video-upstream.c b/drivers/staging/cx25821/cx25821-video-upstream.c index 25bfd8a..eb0172b 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream.c +++ b/drivers/staging/cx25821/cx25821-video-upstream.c @@ -279,10 +279,8 @@ void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) dev->_frame_count = 0; dev->_file_status = END_OF_FILE; - if (dev->_irq_queues) { - kfree(dev->_irq_queues); - dev->_irq_queues = NULL; - } + kfree(dev->_irq_queues); + dev->_irq_queues = NULL; kfree(dev->_filename); diff --git a/drivers/staging/keucr/ms.c b/drivers/staging/keucr/ms.c index 7779d3b..b8ced85 100644 --- a/drivers/staging/keucr/ms.c +++ b/drivers/staging/keucr/ms.c @@ -322,17 +322,11 @@ void MS_LibFreeWriteBuf(struct us_data *us) //----- MS_LibFreeLogicalMap() --------------------------------------- int MS_LibFreeLogicalMap(struct us_data *us) { - if (us->MS_Lib.Phy2LogMap) - { - kfree(us->MS_Lib.Phy2LogMap); - us->MS_Lib.Phy2LogMap = NULL; - } + kfree(us->MS_Lib.Phy2LogMap); + us->MS_Lib.Phy2LogMap = NULL; - if (us->MS_Lib.Log2PhyMap) - { - kfree(us->MS_Lib.Log2PhyMap); - us->MS_Lib.Log2PhyMap = NULL; - } + kfree(us->MS_Lib.Log2PhyMap); + us->MS_Lib.Log2PhyMap = NULL; return 0; } diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c index 67bcd41..663b0b8 100644 --- a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c @@ -195,11 +195,8 @@ void free_ieee80211(struct net_device *dev) { struct ieee80211_device *ieee = netdev_priv(dev); int i; - 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/rtl8192e/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c index e2eac7c..57acb3f 100644 --- a/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c @@ -1411,11 +1411,8 @@ int ieee80211_rtl_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/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c index 2640a4f..0de6867 100644 --- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c @@ -2829,11 +2829,8 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee) { down(&ieee->wx_sem); #ifdef ENABLE_DOT11D - if(NULL != ieee->pDot11dInfo) - { - kfree(ieee->pDot11dInfo); - ieee->pDot11dInfo = NULL; - } + kfree(ieee->pDot11dInfo); + ieee->pDot11dInfo = NULL; #endif del_timer_sync(&ieee->associate_timer); 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/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index ae4f2b9..8d4142a 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2276,10 +2276,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 +2302,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 +5822,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 +5861,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); diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index cd981a1..42fcf7e 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -1305,10 +1305,8 @@ void speakup_deallocate(struct vc_data *vc) int vc_num; vc_num = vc->vc_num; - if (speakup_console[vc_num] != NULL) { - kfree(speakup_console[vc_num]); - speakup_console[vc_num] = NULL; - } + kfree(speakup_console[vc_num]); + speakup_console[vc_num] = NULL; } static u_char is_cursor; diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index a6efc03..7843dfd 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -612,10 +612,8 @@ void hfa384x_destroy(hfa384x_t *hw) hfa384x_drvr_stop(hw); hw->state = HFA384x_STATE_PREINIT; - if (hw->scanresults) { - kfree(hw->scanresults); - hw->scanresults = NULL; - } + kfree(hw->scanresults); + hw->scanresults = NULL; /* Now to clean out the auth queue */ while ((skb = skb_dequeue(&hw->authq))) -- 1.7.3.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel