diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-09-04 10:18:25 +0800 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-09-04 19:15:06 +0200 |
commit | cd4520adcab70dbac8db3fe4d41836dca63715a4 (patch) | |
tree | 1ecc693cd7d60dc28b6f027efc2c7c08982723ff /hw/core/qdev.c | |
parent | d578029e71311de1b1476229d88d4aca02b783a3 (diff) |
qdev: Use NULL instead of local_err for qbus_child unrealize
Forcefully unrealize all children regardless of errors in earlier
iterations (if any). We should keep going with cleanup operation
rather than report an error immediately. Therefore store the first
child unrealization failure and propagate it at the end. We also
forcefully unregister vmsd and unrealize actual object, too.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r-- | hw/core/qdev.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 4a1ac5b3f9..6f37cd324a 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -871,18 +871,18 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } dev->pending_deleted_event = false; } else if (!value && dev->realized) { + Error **local_errp = NULL; QLIST_FOREACH(bus, &dev->child_bus, sibling) { + local_errp = local_err ? NULL : &local_err; object_property_set_bool(OBJECT(bus), false, "realized", - &local_err); - if (local_err != NULL) { - break; - } + local_errp); } - if (qdev_get_vmsd(dev) && local_err == NULL) { + if (qdev_get_vmsd(dev)) { vmstate_unregister(dev, qdev_get_vmsd(dev), dev); } - if (dc->unrealize && local_err == NULL) { - dc->unrealize(dev, &local_err); + if (dc->unrealize) { + local_errp = local_err ? NULL : &local_err; + dc->unrealize(dev, local_errp); } dev->pending_deleted_event = true; } |