提交 46d994b1 编写于 作者: I Ilia Mirkin 提交者: Greg Kroah-Hartman

staging: brcm80211: Remove NULL check before kfree

This patch was generated by the following semantic patch:
// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);

@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>
Signed-off-by: NIlia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 23c32986
...@@ -415,7 +415,6 @@ int dhd_prot_attach(dhd_pub_t *dhd) ...@@ -415,7 +415,6 @@ int dhd_prot_attach(dhd_pub_t *dhd)
return 0; return 0;
fail: fail:
if (cdc != NULL)
kfree(cdc); kfree(cdc);
return BCME_NOMEM; return BCME_NOMEM;
} }
......
...@@ -996,7 +996,6 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, ...@@ -996,7 +996,6 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
__func__, arg, rc)); __func__, arg, rc));
fail: fail:
if (arg_org)
kfree(arg_org); kfree(arg_org);
} }
...@@ -1132,10 +1131,8 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) ...@@ -1132,10 +1131,8 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
__func__, arg)); __func__, arg));
fail: fail:
if (arg_org)
kfree(arg_org); kfree(arg_org);
if (buf)
kfree(buf); kfree(buf);
} }
......
...@@ -1777,7 +1777,6 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) ...@@ -1777,7 +1777,6 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
bcmerror = -EFAULT; bcmerror = -EFAULT;
} }
if (buf)
kfree(buf); kfree(buf);
if (bcmerror > 0) if (bcmerror > 0)
......
...@@ -1930,9 +1930,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) ...@@ -1930,9 +1930,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)
#endif /* DHD_DEBUG */ #endif /* DHD_DEBUG */
done: done:
if (mbuffer)
kfree(mbuffer); kfree(mbuffer);
if (str)
kfree(str); kfree(str);
return bcmerror; return bcmerror;
...@@ -1962,7 +1960,6 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) ...@@ -1962,7 +1960,6 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus)
ret = dhdsdio_membytes(bus, false, start, databuf, read_size); ret = dhdsdio_membytes(bus, false, start, databuf, read_size);
if (ret) { if (ret) {
DHD_ERROR(("%s: Error membytes %d\n", __func__, ret)); DHD_ERROR(("%s: Error membytes %d\n", __func__, ret));
if (buf)
kfree(buf); kfree(buf);
return -1; return -1;
} }
...@@ -2081,7 +2078,6 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len) ...@@ -2081,7 +2078,6 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
} }
/* Free the old ones and replace with passed variables */ /* Free the old ones and replace with passed variables */
if (bus->vars)
kfree(bus->vars); kfree(bus->vars);
bus->vars = kmalloc(len, GFP_ATOMIC); bus->vars = kmalloc(len, GFP_ATOMIC);
...@@ -5541,10 +5537,8 @@ static void dhdsdio_release_malloc(dhd_bus_t *bus) ...@@ -5541,10 +5537,8 @@ static void dhdsdio_release_malloc(dhd_bus_t *bus)
bus->rxlen = 0; bus->rxlen = 0;
} }
if (bus->databuf) {
kfree(bus->databuf); kfree(bus->databuf);
bus->databuf = NULL; bus->databuf = NULL;
}
} }
static void dhdsdio_release_dongle(dhd_bus_t *bus) static void dhdsdio_release_dongle(dhd_bus_t *bus)
...@@ -5732,7 +5726,6 @@ static int dhdsdio_download_code_file(struct dhd_bus *bus, char *fw_path) ...@@ -5732,7 +5726,6 @@ static int dhdsdio_download_code_file(struct dhd_bus *bus, char *fw_path)
} }
err: err:
if (memblock)
kfree(memblock); kfree(memblock);
if (image) if (image)
...@@ -5872,7 +5865,6 @@ static int dhdsdio_download_nvram(struct dhd_bus *bus) ...@@ -5872,7 +5865,6 @@ static int dhdsdio_download_nvram(struct dhd_bus *bus)
} }
err: err:
if (memblock)
kfree(memblock); kfree(memblock);
if (image) if (image)
......
...@@ -759,7 +759,6 @@ wlc_phy_t *wlc_phy_attach(shared_phy_t *sh, void *regs, int bandtype, char *vars ...@@ -759,7 +759,6 @@ wlc_phy_t *wlc_phy_attach(shared_phy_t *sh, void *regs, int bandtype, char *vars
return &pi->pubpi_ro; return &pi->pubpi_ro;
err: err:
if (pi)
kfree(pi); kfree(pi);
return NULL; return NULL;
} }
......
...@@ -22383,7 +22383,6 @@ wlc_phy_gen_load_samples_nphy(phy_info_t *pi, u32 f_kHz, u16 max_val, ...@@ -22383,7 +22383,6 @@ wlc_phy_gen_load_samples_nphy(phy_info_t *pi, u32 f_kHz, u16 max_val,
wlc_phy_loadsampletable_nphy(pi, tone_buf, num_samps); wlc_phy_loadsampletable_nphy(pi, tone_buf, num_samps);
if (tone_buf != NULL)
kfree(tone_buf); kfree(tone_buf);
return num_samps; return num_samps;
...@@ -22431,7 +22430,6 @@ wlc_phy_loadsampletable_nphy(phy_info_t *pi, cs32 *tone_buf, ...@@ -22431,7 +22430,6 @@ wlc_phy_loadsampletable_nphy(phy_info_t *pi, cs32 *tone_buf,
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SAMPLEPLAY, num_samps, 0, 32, wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SAMPLEPLAY, num_samps, 0, 32,
data_buf); data_buf);
if (data_buf != NULL)
kfree(data_buf); kfree(data_buf);
if (pi->phyhang_avoid) if (pi->phyhang_avoid)
......
...@@ -1379,7 +1379,6 @@ static void wl_free(struct wl_info *wl) ...@@ -1379,7 +1379,6 @@ static void wl_free(struct wl_info *wl)
for (t = wl->timers; t; t = next) { for (t = wl->timers; t; t = next) {
next = t->next; next = t->next;
#ifdef BCMDBG #ifdef BCMDBG
if (t->name)
kfree(t->name); kfree(t->name);
#endif #endif
kfree(t); kfree(t);
...@@ -1716,7 +1715,6 @@ void wl_free_timer(struct wl_info *wl, struct wl_timer *t) ...@@ -1716,7 +1715,6 @@ void wl_free_timer(struct wl_info *wl, struct wl_timer *t)
if (wl->timers == t) { if (wl->timers == t) {
wl->timers = wl->timers->next; wl->timers = wl->timers->next;
#ifdef BCMDBG #ifdef BCMDBG
if (t->name)
kfree(t->name); kfree(t->name);
#endif #endif
kfree(t); kfree(t);
...@@ -1729,7 +1727,6 @@ void wl_free_timer(struct wl_info *wl, struct wl_timer *t) ...@@ -1729,7 +1727,6 @@ void wl_free_timer(struct wl_info *wl, struct wl_timer *t)
if (tmp->next == t) { if (tmp->next == t) {
tmp->next = t->next; tmp->next = t->next;
#ifdef BCMDBG #ifdef BCMDBG
if (t->name)
kfree(t->name); kfree(t->name);
#endif #endif
kfree(t); kfree(t);
......
...@@ -2160,10 +2160,8 @@ uint wlc_detach(struct wlc_info *wlc) ...@@ -2160,10 +2160,8 @@ uint wlc_detach(struct wlc_info *wlc)
#ifdef BCMDBG #ifdef BCMDBG
if (wlc->country_ie_override) {
kfree(wlc->country_ie_override); kfree(wlc->country_ie_override);
wlc->country_ie_override = NULL; wlc->country_ie_override = NULL;
}
#endif /* BCMDBG */ #endif /* BCMDBG */
{ {
......
...@@ -830,7 +830,6 @@ static int hndotp_nvread(void *oh, char *data, uint *len) ...@@ -830,7 +830,6 @@ static int hndotp_nvread(void *oh, char *data, uint *len)
*len = offset; *len = offset;
out: out:
if (rawotp)
kfree(rawotp); kfree(rawotp);
si_setcoreidx(oi->sih, idx); si_setcoreidx(oi->sih, idx);
......
...@@ -1527,7 +1527,6 @@ static int otp_read_pci(si_t *sih, u16 *buf, uint bufsz) ...@@ -1527,7 +1527,6 @@ static int otp_read_pci(si_t *sih, u16 *buf, uint bufsz)
memcpy(buf, otp, bufsz); memcpy(buf, otp, bufsz);
if (otp)
kfree(otp); kfree(otp);
/* Check CRC */ /* Check CRC */
......
...@@ -559,21 +559,17 @@ static void _dma_detach(dma_info_t *di) ...@@ -559,21 +559,17 @@ static void _dma_detach(dma_info_t *di)
(di->rxdpaorig)); (di->rxdpaorig));
/* free packet pointer vectors */ /* free packet pointer vectors */
if (di->txp) kfree(di->txp);
kfree((void *)di->txp); kfree(di->rxp);
if (di->rxp)
kfree((void *)di->rxp);
/* free tx packet DMA handles */ /* free tx packet DMA handles */
if (di->txp_dmah)
kfree(di->txp_dmah); kfree(di->txp_dmah);
/* free rx packet DMA handles */ /* free rx packet DMA handles */
if (di->rxp_dmah)
kfree(di->rxp_dmah); kfree(di->rxp_dmah);
/* free our private info structure */ /* free our private info structure */
kfree((void *)di); kfree(di);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册