From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed, 8 Feb 2012 23:11:17 +0000 (-0800)
Subject: driver-core: cpu: fix kobject warning when hotplugging a cpu
X-Git-Tag: firefly_0821_release~3680^2~3553^2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=29bb5d4fd3140a7d5d02d858118c74a45f15c296;p=firefly-linux-kernel-4.4.55.git

driver-core: cpu: fix kobject warning when hotplugging a cpu

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>
---

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 23f2c4cd48d1..4dabf5077c48 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -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;