aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 752fb16a817d..2d65311d206e 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -65,7 +65,7 @@ static struct threshold_block threshold_defaults = {
65}; 65};
66 66
67struct threshold_bank { 67struct threshold_bank {
68 struct kobject kobj; 68 struct kobject *kobj;
69 struct threshold_block *blocks; 69 struct threshold_block *blocks;
70 cpumask_t cpus; 70 cpumask_t cpus;
71}; 71};
@@ -433,7 +433,7 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
433 per_cpu(threshold_banks, cpu)[bank]->blocks = b; 433 per_cpu(threshold_banks, cpu)[bank]->blocks = b;
434 434
435 kobject_set_name(&b->kobj, "misc%i", block); 435 kobject_set_name(&b->kobj, "misc%i", block);
436 b->kobj.parent = &per_cpu(threshold_banks, cpu)[bank]->kobj; 436 b->kobj.parent = per_cpu(threshold_banks, cpu)[bank]->kobj;
437 b->kobj.ktype = &threshold_ktype; 437 b->kobj.ktype = &threshold_ktype;
438 err = kobject_register(&b->kobj); 438 err = kobject_register(&b->kobj);
439 if (err) 439 if (err)
@@ -489,7 +489,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
489 goto out; 489 goto out;
490 490
491 err = sysfs_create_link(&per_cpu(device_mce, cpu).kobj, 491 err = sysfs_create_link(&per_cpu(device_mce, cpu).kobj,
492 &b->kobj, name); 492 b->kobj, name);
493 if (err) 493 if (err)
494 goto out; 494 goto out;
495 495
@@ -505,16 +505,15 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
505 goto out; 505 goto out;
506 } 506 }
507 507
508 kobject_set_name(&b->kobj, "threshold_bank%i", bank); 508 b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj);
509 b->kobj.parent = &per_cpu(device_mce, cpu).kobj; 509 if (!b->kobj)
510 goto out_free;
511
510#ifndef CONFIG_SMP 512#ifndef CONFIG_SMP
511 b->cpus = CPU_MASK_ALL; 513 b->cpus = CPU_MASK_ALL;
512#else 514#else
513 b->cpus = per_cpu(cpu_core_map, cpu); 515 b->cpus = per_cpu(cpu_core_map, cpu);
514#endif 516#endif
515 err = kobject_register(&b->kobj);
516 if (err)
517 goto out_free;
518 517
519 per_cpu(threshold_banks, cpu)[bank] = b; 518 per_cpu(threshold_banks, cpu)[bank] = b;
520 519
@@ -531,7 +530,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
531 continue; 530 continue;
532 531
533 err = sysfs_create_link(&per_cpu(device_mce, i).kobj, 532 err = sysfs_create_link(&per_cpu(device_mce, i).kobj,
534 &b->kobj, name); 533 b->kobj, name);
535 if (err) 534 if (err)
536 goto out; 535 goto out;
537 536
@@ -627,7 +626,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
627 deallocate_threshold_block(cpu, bank); 626 deallocate_threshold_block(cpu, bank);
628 627
629free_out: 628free_out:
630 kobject_unregister(&b->kobj); 629 kobject_unregister(b->kobj);
631 kfree(b); 630 kfree(b);
632 per_cpu(threshold_banks, cpu)[bank] = NULL; 631 per_cpu(threshold_banks, cpu)[bank] = NULL;
633} 632}