summaryrefslogtreecommitdiffstats
path: root/hw/ppc
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr_drc.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 15bae5c216..47d94e782a 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -506,11 +506,11 @@ static void realize(DeviceState *d, Error **errp)
trace_spapr_drc_realize_child(spapr_drc_index(drc), child_name);
object_property_add_alias(root_container, link_name,
drc->owner, child_name, &err);
+ g_free(child_name);
if (err) {
- error_report_err(err);
- object_unref(OBJECT(drc));
+ error_propagate(errp, err);
+ return;
}
- g_free(child_name);
vmstate_register(DEVICE(drc), spapr_drc_index(drc), &vmstate_spapr_drc,
drc);
qemu_register_reset(drc_reset, drc);
@@ -522,16 +522,13 @@ static void unrealize(DeviceState *d, Error **errp)
sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d);
Object *root_container;
char name[256];
- Error *err = NULL;
trace_spapr_drc_unrealize(spapr_drc_index(drc));
+ qemu_unregister_reset(drc_reset, drc);
+ vmstate_unregister(DEVICE(drc), &vmstate_spapr_drc, drc);
root_container = container_get(object_get_root(), DRC_CONTAINER_PATH);
snprintf(name, sizeof(name), "%x", spapr_drc_index(drc));
- object_property_del(root_container, name, &err);
- if (err) {
- error_report_err(err);
- object_unref(OBJECT(drc));
- }
+ object_property_del(root_container, name, errp);
}
sPAPRDRConnector *spapr_dr_connector_new(Object *owner, const char *type,