Commit 8343ef2437c599d30568e6b5a257a40bf2f4902b

Authored by Dmitry Adamushko
Committed by Ingo Molnar
1 parent 636a317816

x86-microcode: fix unbalanced use of get_cpu()

Don't use get_cpu() at all. Resort to checking a boot-up CPU (#0) in
microcode_{intel,amd}_module_init().

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 2 changed files with 12 additions and 8 deletions Side-by-side Diff

arch/x86/kernel/microcode_amd.c
... ... @@ -500,13 +500,15 @@
500 500  
501 501 static int __init microcode_amd_module_init(void)
502 502 {
503   - struct cpuinfo_x86 *c = &cpu_data(get_cpu());
  503 + struct cpuinfo_x86 *c = &cpu_data(0);
504 504  
505 505 equiv_cpu_table = NULL;
506   - if (c->x86_vendor == X86_VENDOR_AMD)
507   - return microcode_init(&microcode_amd_ops, THIS_MODULE);
508   - else
  506 + if (c->x86_vendor != X86_VENDOR_AMD) {
  507 + printk(KERN_ERR "microcode: CPU platform is not AMD-capable\n");
509 508 return -ENODEV;
  509 + }
  510 +
  511 + return microcode_init(&microcode_amd_ops, THIS_MODULE);
510 512 }
511 513  
512 514 static void __exit microcode_amd_module_exit(void)
arch/x86/kernel/microcode_intel.c
... ... @@ -531,12 +531,14 @@
531 531  
532 532 static int __init microcode_intel_module_init(void)
533 533 {
534   - struct cpuinfo_x86 *c = &cpu_data(get_cpu());
  534 + struct cpuinfo_x86 *c = &cpu_data(0);
535 535  
536   - if (c->x86_vendor == X86_VENDOR_INTEL)
537   - return microcode_init(&microcode_intel_ops, THIS_MODULE);
538   - else
  536 + if (c->x86_vendor != X86_VENDOR_INTEL) {
  537 + printk(KERN_ERR "microcode: CPU platform is not Intel-capable\n");
539 538 return -ENODEV;
  539 + }
  540 +
  541 + return microcode_init(&microcode_intel_ops, THIS_MODULE);
540 542 }
541 543  
542 544 static void __exit microcode_intel_module_exit(void)