diff options
Diffstat (limited to 'drivers/net/wireless/libertas/cfg.c')
-rw-r--r-- | drivers/net/wireless/libertas/cfg.c | 8 |
1 files changed, 6 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 | } |