From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB70v-0000Xa-EB for qemu-devel@nongnu.org; Thu, 09 Jun 2016 16:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB70u-0000FI-Gq for qemu-devel@nongnu.org; Thu, 09 Jun 2016 16:57:17 -0400 References: <1465494036-23928-1-git-send-email-ehabkost@redhat.com> <5759C573.1070403@redhat.com> <20160609202134.GZ18662@thinpad.lan.raisama.net> From: Eric Blake Message-ID: <5759D824.7070306@redhat.com> Date: Thu, 9 Jun 2016 14:57:08 -0600 MIME-Version: 1.0 In-Reply-To: <20160609202134.GZ18662@thinpad.lan.raisama.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BOhpFVsdNjrAhJOPaAOC7A4loN51xKuMe" Subject: Re: [Qemu-devel] [PATCH] error: Avoid redudant error_propagate() usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost 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 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BOhpFVsdNjrAhJOPaAOC7A4loN51xKuMe Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/09/2016 02:21 PM, Eduardo Habkost wrote: > This patch simplifies code that uses a local_err variable just to immed= iately > use it for an error_propagate() call. >=20 > Done using the following Coccinelle patch: >=20 > +++ b/block.c > @@ -353,7 +353,6 @@ out: > int bdrv_create_file(const char *filename, QemuOpts *opts, Error **err= p) > { > BlockDriver *drv; > - Error *local_err =3D NULL; > int ret; > =20 > drv =3D bdrv_find_protocol(filename, true, errp); > @@ -361,8 +360,7 @@ int bdrv_create_file(const char *filename, QemuOpts= *opts, Error **errp) > return -ENOENT; > } > =20 > - ret =3D bdrv_create(drv, filename, opts, &local_err); > - error_propagate(errp, local_err); > + ret =3D 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --BOhpFVsdNjrAhJOPaAOC7A4loN51xKuMe Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXWdgkAAoJEKeha0olJ0NqzKIH/iwq3bhR/8YlCUoMaF5GVCzv KIYLT4McZHdnGVOIE/kseWyr8BqXMDK6xC96nJ9MxknuKKmb7MMrXlUwEePVhQEq 0Gpj2BmfTxM2fM0KeRKW+khdU4i00laq064WRaWn05pVgCDxbuiRE1wz9DR/L20d ou9zRtgIw3Wii0JxU1Pk7+qUdO5VFspDrW5dLasZiDyEbOoR4+MoSw/TXyn6tAUN KR3P2HxAcrmi1n2IM+DAJ3Lnm/6a1mK+72gbGTzDTM4a+Jgzor09dWbekzDJ0JNh GJOc/H64pDGQz2aIHW0qnYEFL8Hq/jeADdN6rTjJYbVJexianojkFIkxlOPHZW8= =/tBV -----END PGP SIGNATURE----- --BOhpFVsdNjrAhJOPaAOC7A4loN51xKuMe--