#endif
 
 #ifdef CONFIG_MICROCODE_LATE_LOADING
+/**
+ * store_cpu_caps() - Store a snapshot of CPU capabilities
+ * @curr_info: Pointer where to store it
+ *
+ * Returns: None
+ */
+void store_cpu_caps(struct cpuinfo_x86 *curr_info)
+{
+       /* Reload CPUID max function as it might've changed. */
+       curr_info->cpuid_level = cpuid_eax(0);
+
+       /* Copy all capability leafs and pick up the synthetic ones. */
+       memcpy(&curr_info->x86_capability, &boot_cpu_data.x86_capability,
+              sizeof(curr_info->x86_capability));
+
+       /* Get the hardware CPUID leafs */
+       get_cpu_cap(curr_info);
+}
+
 /**
  * microcode_check() - Check if any CPU capabilities changed after an update.
  * @prev_info: CPU capabilities stored before an update.
  */
 void microcode_check(struct cpuinfo_x86 *prev_info)
 {
-       perf_check_microcode();
-
-       /* Reload CPUID max function as it might've changed. */
-       prev_info->cpuid_level = cpuid_eax(0);
+       struct cpuinfo_x86 curr_info;
 
-       /*
-        * Copy all capability leafs to pick up the synthetic ones so that
-        * memcmp() below doesn't fail on that. The ones coming from CPUID will
-        * get overwritten in get_cpu_cap().
-        */
-       memcpy(&prev_info->x86_capability, &boot_cpu_data.x86_capability,
-              sizeof(prev_info->x86_capability));
+       perf_check_microcode();
 
-       get_cpu_cap(prev_info);
+       store_cpu_caps(&curr_info);
 
-       if (!memcmp(&prev_info->x86_capability, &boot_cpu_data.x86_capability,
+       if (!memcmp(&prev_info->x86_capability, &curr_info.x86_capability,
                    sizeof(prev_info->x86_capability)))
                return;
 
 
        atomic_set(&late_cpus_in,  0);
        atomic_set(&late_cpus_out, 0);
 
+       /*
+        * Take a snapshot before the microcode update in order to compare and
+        * check whether any bits changed after an update.
+        */
+       store_cpu_caps(&prev_info);
+
        ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask);
        if (ret == 0)
                microcode_check(&prev_info);