Merge tag 'x86_mm_for_6.2_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
[linux-block.git] / net / wireless / reg.c
index c3d950d294329b56b77f1fd6f1dee157a5075dc9..4f3f31244e8ba16132aaf59c045b2f47fe9907a2 100644 (file)
@@ -4311,8 +4311,10 @@ static int __init regulatory_init_db(void)
                return -EINVAL;
 
        err = load_builtin_regdb_keys();
-       if (err)
+       if (err) {
+               platform_device_unregister(reg_pdev);
                return err;
+       }
 
        /* We always try to get an update for the static regdomain */
        err = regulatory_hint_core(cfg80211_world_regdom->alpha2);