qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_prope


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_property_find
Date: Sat, 26 May 2012 11:58:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]