From: Luiz Capitulino <lcapitulino@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, anthony@codemonkey.ws,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PULL 10/13] qom: catch errors in object_property_add_child
Date: Wed, 18 Dec 2013 17:17:56 -0500 [thread overview]
Message-ID: <20131218171756.11da0811@redhat.com> (raw)
In-Reply-To: <52B1F2CF.4060400@suse.de>
On Wed, 18 Dec 2013 20:09:03 +0100
Andreas Färber <afaerber@suse.de> wrote:
> Am 18.12.2013 18:00, schrieb Luiz Capitulino:
> > From: Paolo Bonzini <pbonzini@redhat.com>
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > Reviewed-By: Igor Mammedov <imammedo@redhat.com>
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> > qom/object.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > 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 = NULL;
> > gchar *type;
> >
> > type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child)));
> >
> > object_property_add(obj, name, type, object_get_child_property,
> > - NULL, object_finalize_child_property, child, errp);
> > -
> > + NULL, object_finalize_child_property, child, &local_err);
> > + if (error_is_set(&local_err)) {
>
> 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.
>
> Andreas
>
> > + error_propagate(errp, local_err);
> > + goto out;
> > + }
> > object_ref(child);
> > g_assert(child->parent == NULL);
> > child->parent = obj;
> >
> > +out:
> > g_free(type);
> > }
> >
> >
>
>
next prev parent reply other threads:[~2013-12-18 22:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 16:59 [Qemu-devel] [PULL 00/13] QMP queue Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 01/13] vl: add missing transition debug->finish_migrate Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 02/13] error: Add error_abort Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 03/13] hw/core/qdev: Delete dead code Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 04/13] hw: Remove assert_no_error usages Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 05/13] target-i386: Remove assert_no_error usage Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 06/13] qemu-option: Remove qemu_opts_create_nofail Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 07/13] qerror: Remove assert_no_error() Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 08/13] rng: initialize file descriptor to -1 Luiz Capitulino
2013-12-18 16:59 ` [Qemu-devel] [PULL 09/13] qom: fix leak for objects created with -object Luiz Capitulino
2013-12-18 17:00 ` [Qemu-devel] [PULL 10/13] qom: catch errors in object_property_add_child Luiz Capitulino
2013-12-18 19:09 ` Andreas Färber
2013-12-18 19:58 ` Markus Armbruster
2013-12-18 22:17 ` Luiz Capitulino [this message]
2013-12-20 2:27 ` Peter Crosthwaite
2013-12-18 17:00 ` [Qemu-devel] [PULL 11/13] monitor: add object-add (QMP) and object_add (HMP) command Luiz Capitulino
2013-12-20 2:15 ` Peter Crosthwaite
2013-12-20 13:33 ` Luiz Capitulino
2013-12-18 17:00 ` [Qemu-devel] [PULL 12/13] monitor: add object-del (QMP) and object_del " Luiz Capitulino
2013-12-18 17:00 ` [Qemu-devel] [PULL 13/13] qemu-monitor: HMP cpu-add wrapper Luiz Capitulino
2013-12-20 0:32 ` [Qemu-devel] [PULL 00/13] QMP queue Peter Maydell
2013-12-20 0:44 ` Li Guang
2013-12-20 0:49 ` Anthony Liguori
2013-12-20 4:00 ` Peter Crosthwaite
2013-12-20 13:28 ` Luiz Capitulino
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=20131218171756.11da0811@redhat.com \
--to=lcapitulino@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@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).