aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/core.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 3b74b88e10a3..d5850292b3df 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -395,21 +395,23 @@ int wiphy_register(struct wiphy *wiphy)
395 /* check and set up bitrates */ 395 /* check and set up bitrates */
396 ieee80211_set_bitrate_flags(wiphy); 396 ieee80211_set_bitrate_flags(wiphy);
397 397
398 mutex_lock(&cfg80211_mutex);
399
400 /* set up regulatory info */
401 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
402
403 res = device_add(&drv->wiphy.dev); 398 res = device_add(&drv->wiphy.dev);
404 if (res) 399 if (res)
405 goto out_unlock; 400 return res;
406 401
407 res = rfkill_register(drv->rfkill); 402 res = rfkill_register(drv->rfkill);
408 if (res) 403 if (res)
409 goto out_rm_dev; 404 goto out_rm_dev;
410 405
406 mutex_lock(&cfg80211_mutex);
407
408 /* set up regulatory info */
409 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
410
411 list_add(&drv->list, &cfg80211_drv_list); 411 list_add(&drv->list, &cfg80211_drv_list);
412 412
413 mutex_unlock(&cfg80211_mutex);
414
413 /* add to debugfs */ 415 /* add to debugfs */
414 drv->wiphy.debugfsdir = 416 drv->wiphy.debugfsdir =
415 debugfs_create_dir(wiphy_name(&drv->wiphy), 417 debugfs_create_dir(wiphy_name(&drv->wiphy),
@@ -430,13 +432,10 @@ int wiphy_register(struct wiphy *wiphy)
430 432
431 cfg80211_debugfs_drv_add(drv); 433 cfg80211_debugfs_drv_add(drv);
432 434
433 res = 0; 435 return 0;
434 goto out_unlock;
435 436
436 out_rm_dev: 437 out_rm_dev:
437 device_del(&drv->wiphy.dev); 438 device_del(&drv->wiphy.dev);
438 out_unlock:
439 mutex_unlock(&cfg80211_mutex);
440 return res; 439 return res;
441} 440}
442EXPORT_SYMBOL(wiphy_register); 441EXPORT_SYMBOL(wiphy_register);