Commit 6b028c5e authored by Hante Meuleman's avatar Hante Meuleman Committed by John W. Linville

brcmfmac: handle exceptions in brcmf_bus_start correct.

On exception during brcmf_bus_start the netdev should be freed,
if already allocated.
Reviewed-by: default avatarArend Van Spriel <arend@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarHante Meuleman <meuleman@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent db22ae8c
...@@ -708,7 +708,6 @@ int brcmf_net_attach(struct brcmf_if *ifp) ...@@ -708,7 +708,6 @@ int brcmf_net_attach(struct brcmf_if *ifp)
fail: fail:
ndev->netdev_ops = NULL; ndev->netdev_ops = NULL;
free_netdev(ndev);
return -EBADE; return -EBADE;
} }
...@@ -858,15 +857,21 @@ int brcmf_bus_start(struct device *dev) ...@@ -858,15 +857,21 @@ int brcmf_bus_start(struct device *dev)
/* Bus is ready, do any initialization */ /* Bus is ready, do any initialization */
ret = brcmf_c_preinit_dcmds(ifp); ret = brcmf_c_preinit_dcmds(ifp);
if (ret < 0) if (ret < 0)
return ret; goto fail;
drvr->config = brcmf_cfg80211_attach(drvr); drvr->config = brcmf_cfg80211_attach(drvr);
if (drvr->config == NULL) if (drvr->config == NULL) {
return -ENOMEM; ret = -ENOMEM;
goto fail;
}
ret = brcmf_net_attach(ifp); ret = brcmf_net_attach(ifp);
fail:
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "brcmf_net_attach failed"); brcmf_dbg(ERROR, "brcmf_net_attach failed");
if (drvr->config)
brcmf_cfg80211_detach(drvr->config);
free_netdev(drvr->iflist[0]->ndev);
drvr->iflist[0] = NULL; drvr->iflist[0] = NULL;
return ret; return ret;
} }
......
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