From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>,
qemu-stable@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PULL 6/7] qdev: Use NULL instead of local_err for qbus_child unrealize
Date: Thu, 4 Sep 2014 19:21:14 +0200 [thread overview]
Message-ID: <1409851275-14941-7-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1409851275-14941-1-git-send-email-afaerber@suse.de>
From: Gonglei <arei.gonglei@huawei.com>
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>
---
hw/core/qdev.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 4a1ac5b..6f37cd3 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;
}
--
1.8.4.5
next prev parent reply other threads:[~2014-09-04 17:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 17:21 [Qemu-devel] [PULL for-2.1 0/7] QOM devices patch queue 2014-09-04 Andreas Färber
2014-09-04 17:21 ` [Qemu-devel] [PULL 1/7] qom: Make object_child_foreach() safe for objects removal Andreas Färber
2014-09-04 17:21 ` [Qemu-devel] [PULL 2/7] machine: Clean up -machine handling Andreas Färber
2014-09-04 17:21 ` [Qemu-devel] [PULL 3/7] qom: Add automatic arrayification to object_property_add() Andreas Färber
2014-09-04 17:21 ` [Qemu-devel] [PULL 4/7] memory: Remove object_property_add_child_array() Andreas Färber
2014-09-04 17:21 ` [Qemu-devel] [PULL 5/7] qdev: Use error_abort instead of using local_err Andreas Färber
2014-09-04 17:21 ` Andreas Färber [this message]
2014-09-04 17:21 ` [Qemu-devel] [PULL 7/7] qdev: Add cleanup logic in device_set_realized() to avoid resource leak Andreas Färber
2014-09-05 10:15 ` [Qemu-devel] [PULL for-2.1 0/7] QOM devices patch queue 2014-09-04 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409851275-14941-7-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=arei.gonglei@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).