From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYDlo-0000zH-Cs for qemu-devel@nongnu.org; Sat, 26 May 2012 05:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYDlm-0003WG-P3 for qemu-devel@nongnu.org; Sat, 26 May 2012 05:58:47 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:51130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYDlm-0003W8-Fa for qemu-devel@nongnu.org; Sat, 26 May 2012 05:58:46 -0400 Received: by wgbfm10 with SMTP id fm10so1545038wgb.10 for ; Sat, 26 May 2012 02:58:44 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FC0A951.8080005@redhat.com> Date: Sat, 26 May 2012 11:58:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1337787881-3579-1-git-send-email-pbonzini@redhat.com> <1337787881-3579-4-git-send-email-pbonzini@redhat.com> <4FBFADDB.2070609@suse.de> In-Reply-To: <4FBFADDB.2070609@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_property_find List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= Cc: imammedo@redhat.com, qemu-devel@nongnu.org, Anthony Liguori , peter.maydell@linaro.org 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