From: Hante Meuleman Date: Tue, 6 Nov 2012 00:22:30 +0000 (-0800) Subject: brcmfmac: on halting driver check before release or free. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=817b178c83e339f908b9f215ad884834e8710963;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git brcmfmac: on halting driver check before release or free. brcmf_netdev_stop shall first check bus_if status before bringing down cfg80211. brcmf_detach shall first check if driver is allocated. Reviewed-by: Arend Van Spriel Signed-off-by: Hante Meuleman Signed-off-by: Franky Lin Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index a0d8950ed5b1..2bb12072dbdc 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -600,10 +600,12 @@ static int brcmf_netdev_stop(struct net_device *ndev) struct brcmf_pub *drvr = ifp->drvr; brcmf_dbg(TRACE, "Enter\n"); - brcmf_cfg80211_down(drvr->config); + if (drvr->bus_if->drvr_up == 0) return 0; + brcmf_cfg80211_down(drvr->config); + /* Set state and stop OS transmissions */ drvr->bus_if->drvr_up = false; netif_stop_queue(ndev); @@ -905,6 +907,8 @@ void brcmf_detach(struct device *dev) brcmf_dbg(TRACE, "Enter\n"); + if (drvr == NULL) + return; /* make sure primary interface removed last */ for (i = BRCMF_MAX_IFS-1; i > -1; i--)