struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
        int err = 0;
 
-       /* We should bind the task to the CPU */
-       BUG_ON(raw_smp_processor_id() != cpu);
-
-       mutex_lock(µcode_mutex);
        /*
         * Check if the system resume is in progress (uci->valid != NULL),
         * otherwise just request a firmware:
                        err = microcode_ops->request_microcode_fw(cpu,
                                        µcode_pdev->dev);
        }
-
        if (!err)
                microcode_ops->apply_microcode(cpu);
-
-       mutex_unlock(µcode_mutex);
 }
 
 static void microcode_init_cpu(int cpu)
        cpumask_t old = current->cpus_allowed;
 
        set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
+       /* We should bind the task to the CPU */
+       BUG_ON(raw_smp_processor_id() != cpu);
+
+       mutex_lock(µcode_mutex);
        microcode_update_cpu(cpu);
+       mutex_unlock(µcode_mutex);
+
        set_cpus_allowed_ptr(current, &old);
 }