]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
brcmfmac: move "cfg80211_ops" pointer to another struct
authorRafał Miłecki <rafal@milecki.pl>
Tue, 3 Sep 2019 04:29:26 +0000 (06:29 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 13 Sep 2019 13:42:32 +0000 (16:42 +0300)
This moves "ops" pointer from "struct brcmf_cfg80211_info" to the
"struct brcmf_pub". This movement makes it possible to allocate wiphy
without attaching cfg80211 (brcmf_cfg80211_attach()). It's required for
later separation of wiphy allocation and driver initialization.

While at it fix also an unlikely memory leak in the brcmf_attach().

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h

index dd6303f5f72e047bc6f3848bf90821d052d88bf5..e3ebb7abbdaedcb6df4d06485c2c2f01f36eea3f 100644 (file)
@@ -7202,7 +7202,6 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
        brcmf_pno_detach(cfg);
        brcmf_btcoex_detach(cfg);
        wiphy_unregister(cfg->wiphy);
-       kfree(cfg->ops);
        wl_deinit_priv(cfg);
        brcmf_free_wiphy(cfg->wiphy);
        kfree(cfg);
index b7b50b07f7761c457f2a6ea0fae9506269ac8d28..14d5bbad1db13fea211da8d4dc985213132c6688 100644 (file)
@@ -292,7 +292,6 @@ struct brcmf_cfg80211_wowl {
  */
 struct brcmf_cfg80211_info {
        struct wiphy *wiphy;
-       struct cfg80211_ops *ops;
        struct brcmf_cfg80211_conf *conf;
        struct brcmf_p2p_info p2p;
        struct brcmf_btcoex_info *btcoex;
index 21e07d1ceeae5ceb5708510e877983fbd0bd86b5..e8c488376ff9e7235b25a9327bb6040d7383d6ba 100644 (file)
@@ -1224,12 +1224,15 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
                return -ENOMEM;
 
        wiphy = wiphy_new(ops, sizeof(*drvr));
-       if (!wiphy)
+       if (!wiphy) {
+               kfree(ops);
                return -ENOMEM;
+       }
 
        set_wiphy_dev(wiphy, dev);
        drvr = wiphy_priv(wiphy);
        drvr->wiphy = wiphy;
+       drvr->ops = ops;
 
        for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
                drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
@@ -1262,12 +1265,10 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
                goto fail;
        }
 
-       drvr->config->ops = ops;
        return 0;
 
 fail:
        brcmf_detach(dev);
-       kfree(ops);
 
        return ret;
 }
@@ -1353,6 +1354,8 @@ void brcmf_detach(struct device *dev)
 
        bus_if->drvr = NULL;
 
+       kfree(drvr->ops);
+
        wiphy_free(drvr->wiphy);
 }
 
index 86517a3d74b145de2431c9e28414ae53477ab92e..6699637d3bf8c1f959f40bba082ec534b33949c6 100644 (file)
@@ -97,6 +97,7 @@ struct brcmf_pub {
        struct brcmf_bus *bus_if;
        struct brcmf_proto *proto;
        struct wiphy *wiphy;
+       struct cfg80211_ops *ops;
        struct brcmf_cfg80211_info *config;
 
        /* Internal brcmf items */