From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPBZM-0002vB-8J for qemu-devel@nongnu.org; Wed, 03 Sep 2014 10:30:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPBZG-0004cW-Pn for qemu-devel@nongnu.org; Wed, 03 Sep 2014 10:29:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45562 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPBZG-0004YQ-K7 for qemu-devel@nongnu.org; Wed, 03 Sep 2014 10:29:50 -0400 Message-ID: <540725DB.4060707@suse.de> Date: Wed, 03 Sep 2014 16:29:47 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1409659388-9404-1-git-send-email-arei.gonglei@huawei.com> <1409659388-9404-2-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1409659388-9404-2-git-send-email-arei.gonglei@huawei.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 1/4] qdev: using error_abort instead of using local_err List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 , pbonzini@redhat.com, imammedo@redhat.com Am 02.09.2014 14:03, schrieb arei.gonglei@huawei.com: > From: Gonglei >=20 > 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. >=20 > Meanwhile remove superfluous check about local_err. >=20 > Signed-off-by: Gonglei > Reviewed-by: Peter Crosthwaite > --- > hw/core/qdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > 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) > } > =20 > if (value && !dev->realized) { > - if (!obj->parent && local_err =3D=3D NULL) { > + if (!obj->parent) { > static int unattached_count; > gchar *name =3D g_strdup_printf("device[%d]", unattached_c= ount++); > =20 > object_property_add_child(container_get(qdev_get_machine()= , > "/unattached"), > - name, obj, &local_err); > + name, obj, &error_abort); > g_free(name); > } > =20 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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg