aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/cfg.c')
-rw-r--r--drivers/net/wireless/libertas/cfg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 4396dccd12ac..ce7bec402a33 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -6,6 +6,7 @@
6 * 6 *
7 */ 7 */
8 8
9#include <linux/slab.h>
9#include <net/cfg80211.h> 10#include <net/cfg80211.h>
10 11
11#include "cfg.h" 12#include "cfg.h"
@@ -172,6 +173,8 @@ int lbs_cfg_register(struct lbs_private *priv)
172 if (ret < 0) 173 if (ret < 0)
173 lbs_pr_err("cannot register wiphy device\n"); 174 lbs_pr_err("cannot register wiphy device\n");
174 175
176 priv->wiphy_registered = true;
177
175 ret = register_netdev(priv->dev); 178 ret = register_netdev(priv->dev);
176 if (ret) 179 if (ret)
177 lbs_pr_err("cannot register network device\n"); 180 lbs_pr_err("cannot register network device\n");
@@ -190,9 +193,11 @@ void lbs_cfg_free(struct lbs_private *priv)
190 if (!wdev) 193 if (!wdev)
191 return; 194 return;
192 195
193 if (wdev->wiphy) { 196 if (priv->wiphy_registered)
194 wiphy_unregister(wdev->wiphy); 197 wiphy_unregister(wdev->wiphy);
198
199 if (wdev->wiphy)
195 wiphy_free(wdev->wiphy); 200 wiphy_free(wdev->wiphy);
196 } 201
197 kfree(wdev); 202 kfree(wdev);
198} 203}