Merge branch 'x86-bsp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / kernel / cpu.c
index a2491a2d62bbb568cdaf6f68873b7436977cf544..3046a503242c8eb67f031d445713a9e55c986e73 100644 (file)
@@ -348,11 +348,13 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
        unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
        struct task_struct *idle;
 
-       if (cpu_online(cpu) || !cpu_present(cpu))
-               return -EINVAL;
-
        cpu_hotplug_begin();
 
+       if (cpu_online(cpu) || !cpu_present(cpu)) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        idle = idle_thread_get(cpu);
        if (IS_ERR(idle)) {
                ret = PTR_ERR(idle);