aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/cfg.c8
-rw-r--r--drivers/net/wireless/libertas/dev.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 4396dccd12ac..82ebe1461a77 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -172,6 +172,8 @@ int lbs_cfg_register(struct lbs_private *priv)
172 if (ret < 0) 172 if (ret < 0)
173 lbs_pr_err("cannot register wiphy device\n"); 173 lbs_pr_err("cannot register wiphy device\n");
174 174
175 priv->wiphy_registered = true;
176
175 ret = register_netdev(priv->dev); 177 ret = register_netdev(priv->dev);
176 if (ret) 178 if (ret)
177 lbs_pr_err("cannot register network device\n"); 179 lbs_pr_err("cannot register network device\n");
@@ -190,9 +192,11 @@ void lbs_cfg_free(struct lbs_private *priv)
190 if (!wdev) 192 if (!wdev)
191 return; 193 return;
192 194
193 if (wdev->wiphy) { 195 if (priv->wiphy_registered)
194 wiphy_unregister(wdev->wiphy); 196 wiphy_unregister(wdev->wiphy);
197
198 if (wdev->wiphy)
195 wiphy_free(wdev->wiphy); 199 wiphy_free(wdev->wiphy);
196 } 200
197 kfree(wdev); 201 kfree(wdev);
198} 202}
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 058d1720242e..a54880e4ad2b 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -36,6 +36,7 @@ struct lbs_private {
36 36
37 /* CFG80211 */ 37 /* CFG80211 */
38 struct wireless_dev *wdev; 38 struct wireless_dev *wdev;
39 bool wiphy_registered;
39 40
40 /* Mesh */ 41 /* Mesh */
41 struct net_device *mesh_dev; /* Virtual device */ 42 struct net_device *mesh_dev; /* Virtual device */