@@ -837,17 +837,8 @@ struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev)
wdev->wiphy->cipher_suites = cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
- ret = wiphy_register(wdev->wiphy);
- if (ret < 0) {
- dev_err(dev, "Couldn't register wiphy device\n");
- goto out_err_register;
- }
-
return wdev;
- out_err_register:
- wiphy_free(wdev->wiphy);
-
out_err_new:
kfree(wdev);
@@ -145,6 +145,12 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
iwm_init_default_profile(iwm, iwm->umac_profile);
+ ret = wiphy_register(wdev->wiphy);
+ if (ret < 0) {
+ dev_err(dev, "Couldn't register wiphy device\n");
+ goto out_profile;
+ }
+
return iwm;
out_profile: