From: "Andreas Färber" <afaerber@suse.de>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: peter.crosthwaite@xilinx.com, weidong.huang@huawei.com,
mst@redhat.com, luonengjun@huawei.com,
peter.huangpeng@huawei.com, pbonzini@redhat.com,
imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH v6 2/3] qdev: using NULL instead of local_err for qbus_child unrealize
Date: Thu, 04 Sep 2014 18:24:27 +0200 [thread overview]
Message-ID: <5408923B.2020302@suse.de> (raw)
In-Reply-To: <1409797106-9076-3-git-send-email-arei.gonglei@huawei.com>
Am 04.09.2014 04:18, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
>
> Forcefully unrealize all children regardless of early-iteration
> errors(if happened). We should keep going with cleanup operation
> rather than report a error immediately, meanwhile store the first
> child unrealize failure and propagate it at the end. We also
> forcefully un-vmsding and unrealizing actual object too.
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> 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;
> }
This looks much cleaner now, thanks, applied.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2014-09-04 16:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 2:18 [Qemu-devel] [PATCH v6 0/3] Refactor device_set_realized to avoid resource leak arei.gonglei
2014-09-04 2:18 ` [Qemu-devel] [PATCH v6 1/3] qdev: using error_abort instead of using local_err arei.gonglei
2014-09-04 2:18 ` [Qemu-devel] [PATCH v6 2/3] qdev: using NULL instead of local_err for qbus_child unrealize arei.gonglei
2014-09-04 16:24 ` Andreas Färber [this message]
2014-09-04 2:18 ` [Qemu-devel] [PATCH v6 3/3] qdev: add cleanup logic in device_set_realized() to avoid resource leak arei.gonglei
2014-09-04 15:30 ` [Qemu-devel] [PATCH v6 0/3] Refactor device_set_realized " Michael S. Tsirkin
2014-09-04 15:48 ` Andreas Färber
2014-09-04 16:02 ` Michael S. Tsirkin
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=5408923B.2020302@suse.de \
--to=afaerber@suse.de \
--cc=arei.gonglei@huawei.com \
--cc=imammedo@redhat.com \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=weidong.huang@huawei.com \
/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).