diff options
author | Greg Kurz <groug@kaod.org> | 2017-05-15 13:39:55 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-05-24 11:39:52 +1000 |
commit | c8a98293f7fe672fc3b7a3caafede701fbb3180e (patch) | |
tree | 2d58edc966e9380988ab7231555a30dca25ac1ef /hw/ppc | |
parent | 175d2aa038c530d07a8eb5f483c6b1c4b3df43e0 (diff) | |
download | qemu-c8a98293f7fe672fc3b7a3caafede701fbb3180e.zip qemu-c8a98293f7fe672fc3b7a3caafede701fbb3180e.tar.gz qemu-c8a98293f7fe672fc3b7a3caafede701fbb3180e.tar.bz2 |
spapr-cpu-core: release ICP object when realization fails
While here we introduce a single error path to avoid code duplication.
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr_cpu_core.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index a17ea07..1df1404 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -147,25 +147,25 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp) object_property_add_const_link(obj, "xics", OBJECT(spapr), &error_abort); object_property_set_bool(obj, true, "realized", &local_err); if (local_err) { - error_propagate(errp, local_err); - return; + goto error; } object_property_set_bool(child, true, "realized", &local_err); if (local_err) { - object_unparent(obj); - error_propagate(errp, local_err); - return; + goto error; } spapr_cpu_init(spapr, cpu, &local_err); if (local_err) { - object_unparent(obj); - error_propagate(errp, local_err); - return; + goto error; } xics_cpu_setup(XICS_FABRIC(spapr), cpu, ICP(obj)); + return; + +error: + object_unparent(obj); + error_propagate(errp, local_err); } static void spapr_cpu_core_realize(DeviceState *dev, Error **errp) |