From: "Arend van Spriel" <arend@broadcom.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH for 3.10 4/7] brcmfmac: free net device when registration fails
Date: Mon, 27 May 2013 21:09:56 +0200 [thread overview]
Message-ID: <1369681799-3163-5-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1369681799-3163-1-git-send-email-arend@broadcom.com>
When registration fails the net device is no longer needed. Free
the net device and remove reference to private data from the
driver.
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | 10 +++++++---
drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 3 ++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index 59c2546..f04e355 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -656,7 +656,9 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked)
return 0;
fail:
+ drvr->iflist[ifp->bssidx] = NULL;
ndev->netdev_ops = NULL;
+ free_netdev(ndev);
return -EBADE;
}
@@ -720,6 +722,9 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
return 0;
fail:
+ ifp->drvr->iflist[ifp->bssidx] = NULL;
+ ndev->netdev_ops = NULL;
+ free_netdev(ndev);
return -EBADE;
}
@@ -925,8 +930,6 @@ fail:
brcmf_fws_del_interface(ifp);
brcmf_fws_deinit(drvr);
}
- free_netdev(ifp->ndev);
- drvr->iflist[0] = NULL;
if (p2p_ifp) {
free_netdev(p2p_ifp->ndev);
drvr->iflist[1] = NULL;
@@ -934,7 +937,8 @@ fail:
return ret;
}
if ((brcmf_p2p_enable) && (p2p_ifp))
- brcmf_net_p2p_attach(p2p_ifp);
+ if (brcmf_net_p2p_attach(p2p_ifp) < 0)
+ brcmf_p2p_enable = 0;
return 0;
}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
index 5a64280..83ee53a 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
@@ -202,7 +202,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
return;
brcmf_fws_add_interface(ifp);
if (!drvr->fweh.evt_handler[BRCMF_E_IF])
- err = brcmf_net_attach(ifp, false);
+ if (brcmf_net_attach(ifp, false) < 0)
+ return;
}
if (ifevent->action == BRCMF_E_IF_CHANGE)
--
1.7.10.4
next prev parent reply other threads:[~2013-05-27 19:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 19:09 [PATCH for 3.10 0/7] brcmfmac: AP and P2P mode fixes Arend van Spriel
2013-05-27 19:09 ` [PATCH for 3.10 1/7] brcmfmac: Turn off ARP offloading when configured for AP Arend van Spriel
2013-05-27 19:09 ` [PATCH for 3.10 2/7] brcmfmac: Fix p2p setup when connected to ap on 5G Arend van Spriel
2013-05-27 19:09 ` [PATCH for 3.10 3/7] brcmfmac: add additional parameter to brcmf_free_vif() Arend van Spriel
2013-05-27 19:09 ` Arend van Spriel [this message]
2013-05-27 19:09 ` [PATCH for 3.10 5/7] brcmfmac: use struct net_device::destructor to remove interfaces Arend van Spriel
2013-05-27 19:09 ` [PATCH for 3.10 6/7] brcmfmac: Add multi channel support for P2P Arend van Spriel
2013-05-27 19:09 ` [PATCH for 3.10 7/7] brcmfmac: Disable powersave mode for P2P link Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369681799-3163-5-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox