From: Paolo Bonzini <pbonzini@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: imammedo@redhat.com, qemu-devel@nongnu.org,
Anthony Liguori <anthony@codemonkey.ws>,
peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_property_find
Date: Sat, 26 May 2012 11:58:41 +0200 [thread overview]
Message-ID: <4FC0A951.8080005@redhat.com> (raw)
In-Reply-To: <4FBFADDB.2070609@suse.de>
Il 25/05/2012 18:05, Andreas Färber ha scritto:
>> > @@ -698,10 +702,8 @@ void object_property_del(Object *obj, const char *name, Error **errp)
>> > void object_property_get(Object *obj, Visitor *v, const char *name,
>> > Error **errp)
>> > {
>> > - ObjectProperty *prop = object_property_find(obj, name);
>> > -
>> > + ObjectProperty *prop = object_property_find(obj, name, errp);
>> > if (prop == NULL) {
>> > - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name);
>> > return;
>> > }
>> >
> Currently it doesn't happen, but I wonder if we should check
> error_is_set(errp) instead of or in addition to prop == NULL now?
> Applies to all callsites above and below.
No, because errp can be NULL. The rules are:
- if errors are also signaled by the return value, check the return value;
- otherwise, use a local variable and error_propagate. You can test the
local variable against NULL directly, error_is_set is only needed if you
have an Error **.
In fact, using error_is_set is almost always wrong and we could probably
kill it.
Paolo
next prev parent reply other threads:[~2012-05-26 9:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 15:44 [Qemu-devel] [PATCH 00/10] push static properties to Object, add realized property Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 01/10] qdev: remove PropertyInfo range checking Paolo Bonzini
2012-05-24 17:50 ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 02/10] qdev: remove qdev_prop_exists Paolo Bonzini
2012-05-24 21:34 ` Andreas Färber
2012-05-25 7:20 ` Paolo Bonzini
2012-05-25 15:57 ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_property_find Paolo Bonzini
2012-05-25 16:05 ` Andreas Färber
2012-05-26 9:58 ` Paolo Bonzini [this message]
2012-05-26 22:04 ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 04/10] qom: add get_id Paolo Bonzini
2012-05-25 16:33 ` Andreas Färber
2012-05-25 17:39 ` malc
2012-05-23 15:44 ` [Qemu-devel] [PATCH 05/10] qdev: push state up to Object Paolo Bonzini
2012-05-25 16:58 ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 06/10] qdev: generalize properties to Objects Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 07/10] qdev: move bulk of qdev-properties.c to qom/object.c Paolo Bonzini
2012-05-25 13:32 ` Andreas Färber
2012-05-25 13:36 ` Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 08/10] qom: push static properties to Object Paolo Bonzini
2012-06-07 16:36 ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 09/10] qom: add realized property Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 10/10] qom: Add QERR_PROPERTY_SET_AFTER_REALIZE Paolo Bonzini
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=4FC0A951.8080005@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=imammedo@redhat.com \
--cc=peter.maydell@linaro.org \
--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).