Received: from eggs.gnu.org ([2001:4830:134:3::10]:46924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB7z7-0006CG-Gy for qemu-devel@nongnu.org; Thu, 09 Jun 2016 17:59:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB7z5-0008Sb-Op for qemu-devel@nongnu.org; Thu, 09 Jun 2016 17:59:28 -0400 Date: Thu, 9 Jun 2016 18:59:19 -0300 From: Eduardo Habkost Message-ID: <20160609215919.GD18662@thinpad.lan.raisama.net> References: <1465494036-23928-1-git-send-email-ehabkost@redhat.com> <5759C573.1070403@redhat.com> <20160609202134.GZ18662@thinpad.lan.raisama.net> <5759D824.7070306@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5759D824.7070306@redhat.com> Subject: Re: [Qemu-devel] [PATCH] error: Avoid redudant error_propagate() usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Markus Armbruster , kwolf@redhat.com, cornelia.huck@de.ibm.com, mreitz@redhat.com, qemu-block@nongnu.org, borntraeger@de.ibm.com On Thu, Jun 09, 2016 at 02:57:08PM -0600, Eric Blake wrote: > On 06/09/2016 02:21 PM, Eduardo Habkost wrote: > > This patch simplifies code that uses a local_err variable just to immediately > > use it for an error_propagate() call. > > > > Done using the following Coccinelle patch: > > > > > +++ b/block.c > > @@ -353,7 +353,6 @@ out: > > int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp) > > { > > BlockDriver *drv; > > - Error *local_err = NULL; > > int ret; > > > > drv = bdrv_find_protocol(filename, true, errp); > > @@ -361,8 +360,7 @@ int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp) > > return -ENOENT; > > } > > > > - ret = bdrv_create(drv, filename, opts, &local_err); > > - error_propagate(errp, local_err); > > + ret = bdrv_create(drv, filename, opts, errp); > > return ret; > > And I _know_ there's a Coccinelle recipe for further shortening this > into 'return bdrv_create(...)' (since it was part of the tutorial class > at last year's KVM Forum) - again, I don't know the actual syntax to use > to get it, but it shouldn't be too hard to find in a web search. Fine > as yet another followup patch. This is an easy one. I will give it a try. Probably v2 will become a 3-patch series. -- Eduardo