spapr_cpu_core: drop reference on ICP object during CPU realization
commit249127d0dfeb2cf5e24d9353b6d54c91c1666ddc
authorGreg Kurz <groug@kaod.org>
Fri, 19 May 2017 10:32:04 +0000 (19 12:32 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 24 May 2017 01:39:53 +0000 (24 11:39 +1000)
tree2dd72cb66e2fe62e70ac59bd5e17214ad6f2f878
parentbff3063837a76b37a4bbbfe614324ca38e859f2b
spapr_cpu_core: drop reference on ICP object during CPU realization

When a piece of code allocates an object, it implicitely gets a reference
on it. If it then makes that object a child property of another object, it
should drop its own reference at some point otherwise the child object can
never be finalized. The current code hence leaks one ICP object per CPU
when hot-removing a core.

Failing to add a newly allocated ICP object to the CPU is a bug. While here,
let's ensure QEMU aborts if this ever happens.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_cpu_core.c