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, Markus Armbruster <armbru@redhat.com>,
pbonzini@redhat.com, imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 1/4] qdev: using error_abort instead of using local_err
Date: Wed, 03 Sep 2014 16:29:47 +0200 [thread overview]
Message-ID: <540725DB.4060707@suse.de> (raw)
In-Reply-To: <1409659388-9404-2-git-send-email-arei.gonglei@huawei.com>
Am 02.09.2014 14:03, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
>
> This error can not happen normally. If it happens indicates
> something very wrong, we should abort QEMU. moreover, The
> user can only refer to /machine/peripheral, not
> /machine/unattached.
>
> Meanwhile remove superfluous check about local_err.
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> hw/core/qdev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index da1ba48..4a1ac5b 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -820,13 +820,13 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
> }
>
> if (value && !dev->realized) {
> - if (!obj->parent && local_err == NULL) {
> + if (!obj->parent) {
> static int unattached_count;
> gchar *name = g_strdup_printf("device[%d]", unattached_count++);
>
> object_property_add_child(container_get(qdev_get_machine(),
> "/unattached"),
> - name, obj, &local_err);
> + name, obj, &error_abort);
> g_free(name);
> }
>
One way to trigger this abort would be for the user to add a property of
that format via -object or similar mechanisms, when allowing a custom
path. Today, objects are always under /objects though.
In fact the only way to get an Error** back from
object_property_add[_child]() is if a duplicate property exists. Any
other error conditions would already abort in GLib code.
Anyway, this is not strictly an error fix and it's a question of how
much we want to protect the user from his own stupidity, so I'm leaning
towards applying this patch. I'd prefer to decouple it from the other
cleanup though.
Regards,
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-03 14:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 12:03 [Qemu-devel] [PATCH v5 0/4] Refactor device_set_realized to avoid resource leak arei.gonglei
2014-09-02 12:03 ` [Qemu-devel] [PATCH v5 1/4] qdev: using error_abort instead of using local_err arei.gonglei
2014-09-03 14:29 ` Andreas Färber [this message]
2014-09-04 1:03 ` Gonglei (Arei)
2014-09-02 12:03 ` [Qemu-devel] [PATCH v5 2/4] qdev: using NULL instead of local_err for qbus_child unrealize arei.gonglei
2014-09-03 13:08 ` Peter Crosthwaite
2014-09-04 0:58 ` Gonglei (Arei)
2014-09-02 12:03 ` [Qemu-devel] [PATCH v5 3/4] qdev: add cleanup logic in device_set_realized() to avoid resource leak arei.gonglei
2014-09-03 13:08 ` Peter Crosthwaite
2014-09-02 12:03 ` [Qemu-devel] [PATCH v5 4/4] pcie: don't assert when hotplug a PCIe device with 'function != 0' arei.gonglei
2014-09-03 13:48 ` Michael S. Tsirkin
2014-09-04 0:25 ` Gonglei (Arei)
2014-09-02 15:19 ` [Qemu-devel] [PATCH v5 0/4] Refactor device_set_realized to avoid resource leak 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=540725DB.4060707@suse.de \
--to=afaerber@suse.de \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.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).