/* check and set up bitrates */
ieee80211_set_bitrate_flags(wiphy);
- mutex_lock(&cfg80211_mutex);
-
- /* set up regulatory info */
- wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
-
res = device_add(&drv->wiphy.dev);
if (res)
- goto out_unlock;
+ return res;
res = rfkill_register(drv->rfkill);
if (res)
goto out_rm_dev;
+ mutex_lock(&cfg80211_mutex);
+
+ /* set up regulatory info */
+ wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
+
list_add(&drv->list, &cfg80211_drv_list);
+ mutex_unlock(&cfg80211_mutex);
+
/* add to debugfs */
drv->wiphy.debugfsdir =
debugfs_create_dir(wiphy_name(&drv->wiphy),
cfg80211_debugfs_drv_add(drv);
- res = 0;
- goto out_unlock;
+ return 0;
out_rm_dev:
device_del(&drv->wiphy.dev);
- out_unlock:
- mutex_unlock(&cfg80211_mutex);
return res;
}
EXPORT_SYMBOL(wiphy_register);