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>
        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);
 
  */
 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;
 
                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;
                goto fail;
        }
 
-       drvr->config->ops = ops;
        return 0;
 
 fail:
        brcmf_detach(dev);
-       kfree(ops);
 
        return ret;
 }
 
        bus_if->drvr = NULL;
 
+       kfree(drvr->ops);
+
        wiphy_free(drvr->wiphy);
 }
 
 
        struct brcmf_bus *bus_if;
        struct brcmf_proto *proto;
        struct wiphy *wiphy;
+       struct cfg80211_ops *ops;
        struct brcmf_cfg80211_info *config;
 
        /* Internal brcmf items */