From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB6If-0001r0-SF for qemu-devel@nongnu.org; Thu, 09 Jun 2016 16:11:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB6Ie-00063W-Jb for qemu-devel@nongnu.org; Thu, 09 Jun 2016 16:11:33 -0400 References: <1465494036-23928-1-git-send-email-ehabkost@redhat.com> <5759C573.1070403@redhat.com> <20160609195007.GW18662@thinpad.lan.raisama.net> From: Eric Blake Message-ID: <5759CD6B.9000407@redhat.com> Date: Thu, 9 Jun 2016 14:11:23 -0600 MIME-Version: 1.0 In-Reply-To: <20160609195007.GW18662@thinpad.lan.raisama.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hLv16GCGXwLjeWCrlW4sTUQTe4Nha8a7E" Subject: Re: [Qemu-devel] [PATCH] error: Remove NULL checks on error_propagate() calls 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) --hLv16GCGXwLjeWCrlW4sTUQTe4Nha8a7E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/09/2016 01:50 PM, Eduardo Habkost wrote: > On Thu, Jun 09, 2016 at 01:37:23PM -0600, Eric Blake wrote: > [...] >> >> Hmm - it seems like in most of the cases where the ONLY thing done in >> the if (local_err) block is to propagate the error, we should instead = be >> directly assigning to errp instead of wasting a local variable. At th= is >> point, my review is repetitive enough that I'll stop looking, and leav= e >> it up to you and Markus whether to attempt a more ambitious Coccinelle= >> script. >=20 > If it happens immediately before the function end or a return > statement it should be easy, but it would still require some > manual work to remove the unused variable declaration. Probably > easier to do that in a follow-up patch. I think Coccinelle can be used to eliminate unused local variables, but don't know the recipe off-hand; maybe a web search will turn up something= ? >=20 > It's harder (impossible?) to make Coccinelle avoid matching if > local_err is used somewhere else in the function. But it's > probably doable with some manual work, in a follow-up patch. I don't know - Coccinelle is rather powerful, and there may indeed be a way to flag conditions for a variable that is not used anywhere except in the lines mentioned in the recipe, vs. a variable that can also be used in the ... portion of the recipe. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hLv16GCGXwLjeWCrlW4sTUQTe4Nha8a7E 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/ iQEcBAEBCAAGBQJXWc1rAAoJEKeha0olJ0Nqp58IAKa1h1WnL5l3aukyFmZHVzTp YX3xckB+a6hWBMW8Ggr76F6F88N1EctN3AXh96Trgh/ODkBqrwlGa2uiNgZYM6JJ Uz9sLIW2FPIMb1uROtcAtL5y7Qa99Q7F2aAPRAR3EeysZpk8V/crUgQ6OAlZ6nKA t0MWHCy4qQBPFevuzc0xOsvgP5MOsLvgukGz0SbQn2yvmpC09PjHVC29iDMgYH/1 q4jtHsq7e/i6texqyDmpWZ6Tvd5O8cEmUKtuuNYPSGXKLb73Aw+9Wjz5SZdHjKLq 7eh1cu9liBvpseU4WgLtxec2Lzv7DmiEF++qgy0JbCjJbMwoYtgMEx1Le6NdrbQ= =lIiC -----END PGP SIGNATURE----- --hLv16GCGXwLjeWCrlW4sTUQTe4Nha8a7E--