From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtPRO-0004PB-Rk for qemu-devel@nongnu.org; Wed, 18 Dec 2013 17:18:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtPRI-00051A-6F for qemu-devel@nongnu.org; Wed, 18 Dec 2013 17:18:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtPRH-000516-T8 for qemu-devel@nongnu.org; Wed, 18 Dec 2013 17:18:00 -0500 Date: Wed, 18 Dec 2013 17:17:56 -0500 From: Luiz Capitulino Message-ID: <20131218171756.11da0811@redhat.com> In-Reply-To: <52B1F2CF.4060400@suse.de> References: <1387386003-8949-1-git-send-email-lcapitulino@redhat.com> <1387386003-8949-11-git-send-email-lcapitulino@redhat.com> <52B1F2CF.4060400@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PULL 10/13] qom: catch errors in object_property_add_child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?UTF-8?B?RsOkcmJlcg==?= Cc: Paolo Bonzini , qemu-devel@nongnu.org, anthony@codemonkey.ws, Igor Mammedov On Wed, 18 Dec 2013 20:09:03 +0100 Andreas F=C3=A4rber wrote: > Am 18.12.2013 18:00, schrieb Luiz Capitulino: > > From: Paolo Bonzini > >=20 > > Signed-off-by: Paolo Bonzini > > Reviewed-By: Igor Mammedov > > Signed-off-by: Luiz Capitulino > > --- > > qom/object.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > >=20 > > diff --git a/qom/object.c b/qom/object.c > > index fc19cf6..68fe07a 100644 > > --- a/qom/object.c > > +++ b/qom/object.c > > @@ -988,17 +988,22 @@ static void object_finalize_child_property(Object= *obj, const char *name, > > void object_property_add_child(Object *obj, const char *name, > > Object *child, Error **errp) > > { > > + Error *local_err =3D NULL; > > gchar *type; > > =20 > > type =3D g_strdup_printf("child<%s>", object_get_typename(OBJECT(c= hild))); > > =20 > > object_property_add(obj, name, type, object_get_child_property, > > - NULL, object_finalize_child_property, child, e= rrp); > > - > > + NULL, object_finalize_child_property, child, &= local_err); > > + if (error_is_set(&local_err)) { >=20 > I've been told we shouldn't error_is_set() that way but instead write: > if (local_err) { We've talked about adopting an idiom, and the general consensus seems to be checking the error pointer straight is better than calling error_is_set(). I'm OK with both ways and didn't consider rejecting a patch because of that. > No need to respin, but giving me a chance to ack this QOM patch would've > been nice. Oh, sorry for that. As I was preparing a pull request and as this series got two Reviewed-bys (mine and Igor's) I just included it. >=20 > Andreas >=20 > > + error_propagate(errp, local_err); > > + goto out; > > + } > > object_ref(child); > > g_assert(child->parent =3D=3D NULL); > > child->parent =3D obj; > > =20 > > +out: > > g_free(type); > > } > > =20 > >=20 >=20 >=20