Merge tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / arch / s390 / kernel / smp.c
index 8827883310ddbc05c765f17b2125e804dc2cd85e..5a640b395bd4d37ced17d847fd01e6869b487363 100644 (file)
@@ -1057,19 +1057,24 @@ static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
 
 static int __init s390_smp_init(void)
 {
-       int cpu, rc;
+       int cpu, rc = 0;
 
-       hotcpu_notifier(smp_cpu_notify, 0);
 #ifdef CONFIG_HOTPLUG_CPU
        rc = device_create_file(cpu_subsys.dev_root, &dev_attr_rescan);
        if (rc)
                return rc;
 #endif
+       cpu_notifier_register_begin();
        for_each_present_cpu(cpu) {
                rc = smp_add_present_cpu(cpu);
                if (rc)
-                       return rc;
+                       goto out;
        }
-       return 0;
+
+       __hotcpu_notifier(smp_cpu_notify, 0);
+
+out:
+       cpu_notifier_register_done();
+       return rc;
 }
 subsys_initcall(s390_smp_init);