Received: from eggs.gnu.org ([2001:4830:134:3::10]:55618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBGms-00061f-FJ for qemu-devel@nongnu.org; Fri, 10 Jun 2016 03:23:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBGmr-0002Ej-G6 for qemu-devel@nongnu.org; Fri, 10 Jun 2016 03:23:26 -0400 Date: Fri, 10 Jun 2016 09:23:15 +0200 From: Igor Mammedov Message-ID: <20160610092315.2e0de322@nial.brq.redhat.com> In-Reply-To: <5759C5F6.4020405@redhat.com> References: <1465492263-28472-1-git-send-email-imammedo@redhat.com> <1465492263-28472-2-git-send-email-imammedo@redhat.com> <20160609172900.GV18662@thinpad.lan.raisama.net> <5759C5F6.4020405@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/6] target-i386: cpu: consolidate calls of object_property_parse() in x86_cpu_parse_featurestr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Eduardo Habkost , peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, blauwirbel@gmail.com, qemu-arm@nongnu.org, pbonzini@redhat.com, rth@twiddle.net On Thu, 9 Jun 2016 13:39:34 -0600 Eric Blake wrote: > On 06/09/2016 11:29 AM, Eduardo Habkost wrote: > > On Thu, Jun 09, 2016 at 07:10:58PM +0200, Igor Mammedov wrote: > > [...] > >> + > >> + if (local_err) { > >> + error_propagate(errp, local_err); > >> } > > > > error_propagate() already ignores local_err==NULL so you don't > > need to check it first. > > In fact, if the ONLY reason you are doing an 'if (local_err)' > conditional is to decide if an error was set, then you don't care about > the error locally, and could have passed errp instead of &local_err in > the first place. errp might be NULL, so we won't do parsing at all. considering it's more or less generic API hook it's safer to follow error handling pattern used in properties i.e. use local_error internally and then propagate error if caller cares about it.