driver-core: cpu: fix kobject warning when hotplugging a cpu
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Feb 2012 23:11:17 +0000 (15:11 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Feb 2012 23:11:17 +0000 (15:11 -0800)
Due to the sysdev conversion to struct device, the cpu objects get
reused when adding a cpu after offlining it, which causes a big warning
that the kobject portion is not properly initialized.

So clear out the object before we register it again, so all is quiet.

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/cpu.c

index 23f2c4cd48d1d7a93f8e183b0f3652faa3dedb0b..4dabf5077c48575b06a4a25041fca33a8a8fb344 100644 (file)
@@ -240,6 +240,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
        int error;
 
        cpu->node_id = cpu_to_node(num);
+       memset(&cpu->dev, 0x00, sizeof(struct device));
        cpu->dev.id = num;
        cpu->dev.bus = &cpu_subsys;
        cpu->dev.release = cpu_device_release;