Commit 7c0e45d7 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: remove NULL pointer checks before calling kfree

kfree function can handle NULL pointer as passed parameter so there
is no need for the calling function to check for this before calling
kfree.
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarBrett Rudley <brudley@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6cab9150
...@@ -146,17 +146,8 @@ static void wlc_bsscfg_mfree(wlc_bsscfg_t *cfg) ...@@ -146,17 +146,8 @@ static void wlc_bsscfg_mfree(wlc_bsscfg_t *cfg)
if (cfg == NULL) if (cfg == NULL)
return; return;
if (cfg->maclist) { kfree(cfg->maclist);
kfree(cfg->maclist); kfree(cfg->current_bss);
cfg->maclist = NULL;
}
if (cfg->current_bss != NULL) {
wlc_bss_info_t *current_bss = cfg->current_bss;
kfree(current_bss);
cfg->current_bss = NULL;
}
kfree(cfg); kfree(cfg);
} }
...@@ -310,65 +301,19 @@ void wlc_detach_mfree(struct wlc_info *wlc) ...@@ -310,65 +301,19 @@ void wlc_detach_mfree(struct wlc_info *wlc)
if (wlc == NULL) if (wlc == NULL)
return; return;
if (wlc->modulecb) { wlc_bsscfg_mfree(wlc->cfg);
kfree(wlc->modulecb); wlc_pub_mfree(wlc->pub);
wlc->modulecb = NULL; kfree(wlc->modulecb);
} kfree(wlc->default_bss);
kfree(wlc->pkt_callback);
if (wlc->default_bss) { kfree(wlc->wsec_def_keys[0]);
kfree(wlc->default_bss); kfree(wlc->protection);
wlc->default_bss = NULL; kfree(wlc->stf);
} kfree(wlc->bandstate[0]);
if (wlc->cfg) { kfree(wlc->corestate->macstat_snapshot);
wlc_bsscfg_mfree(osh, wlc->cfg); kfree(wlc->corestate);
wlc->cfg = NULL; kfree(wlc->hw->bandstate[0]);
} kfree(wlc->hw);
if (wlc->pkt_callback && wlc->pub && wlc->pub->tunables) {
kfree(wlc->pkt_callback);
wlc->pkt_callback = NULL;
}
if (wlc->wsec_def_keys[0])
kfree(wlc->wsec_def_keys[0]);
if (wlc->protection) {
kfree(wlc->protection);
wlc->protection = NULL;
}
if (wlc->stf) {
kfree(wlc->stf);
wlc->stf = NULL;
}
if (wlc->bandstate[0])
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);
wlc->corestate = NULL;
}
if (wlc->pub) {
/* free pub struct */
wlc_pub_mfree(osh, wlc->pub);
wlc->pub = NULL;
}
if (wlc->hw) {
if (wlc->hw->bandstate[0]) {
kfree(wlc->hw->bandstate[0]);
wlc->hw->bandstate[0] = NULL;
}
/* free hw struct */
kfree(wlc->hw);
wlc->hw = NULL;
}
/* free the wlc */ /* free the wlc */
kfree(wlc); kfree(wlc);
......
...@@ -232,9 +232,7 @@ void wlc_ampdu_detach(struct ampdu_info *ampdu) ...@@ -232,9 +232,7 @@ void wlc_ampdu_detach(struct ampdu_info *ampdu)
/* free all ini's which were to be freed on callbacks which were never called */ /* free all ini's which were to be freed on callbacks which were never called */
for (i = 0; i < AMPDU_INI_FREE; i++) { for (i = 0; i < AMPDU_INI_FREE; i++) {
if (ampdu->ini_free[i]) { kfree(ampdu->ini_free[i]);
kfree(ampdu->ini_free[i]);
}
} }
wlc_module_unregister(ampdu->wlc->pub, "ampdu", ampdu); wlc_module_unregister(ampdu->wlc->pub, "ampdu", ampdu);
......
...@@ -161,9 +161,6 @@ struct antsel_info *wlc_antsel_attach(struct wlc_info *wlc, ...@@ -161,9 +161,6 @@ struct antsel_info *wlc_antsel_attach(struct wlc_info *wlc,
void wlc_antsel_detach(struct antsel_info *asi) void wlc_antsel_detach(struct antsel_info *asi)
{ {
if (!asi)
return;
kfree(asi); kfree(asi);
} }
......
...@@ -1044,10 +1044,8 @@ int wlc_bmac_detach(struct wlc_info *wlc) ...@@ -1044,10 +1044,8 @@ int wlc_bmac_detach(struct wlc_info *wlc)
wlc_phy_shim_detach(wlc_hw->physhim); wlc_phy_shim_detach(wlc_hw->physhim);
/* free vars */ /* free vars */
if (wlc_hw->vars) { kfree(wlc_hw->vars);
kfree(wlc_hw->vars); wlc_hw->vars = NULL;
wlc_hw->vars = NULL;
}
if (wlc_hw->sih) { if (wlc_hw->sih) {
si_detach(wlc_hw->sih); si_detach(wlc_hw->sih);
......
...@@ -683,8 +683,7 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc) ...@@ -683,8 +683,7 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc)
void wlc_channel_mgr_detach(wlc_cm_info_t *wlc_cm) void wlc_channel_mgr_detach(wlc_cm_info_t *wlc_cm)
{ {
if (wlc_cm) kfree(wlc_cm);
kfree(wlc_cm);
} }
u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, uint bandunit) u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm, uint bandunit)
......
...@@ -83,9 +83,6 @@ wlc_phy_shim_info_t *wlc_phy_shim_attach(struct wlc_hw_info *wlc_hw, ...@@ -83,9 +83,6 @@ wlc_phy_shim_info_t *wlc_phy_shim_attach(struct wlc_hw_info *wlc_hw,
void wlc_phy_shim_detach(wlc_phy_shim_info_t *physhim) void wlc_phy_shim_detach(wlc_phy_shim_info_t *physhim)
{ {
if (!physhim)
return;
kfree(physhim); kfree(physhim);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment