From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmR9j-0006J9-Mj for qemu-devel@nongnu.org; Mon, 19 May 2014 13:15:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmR9e-0000ak-OE for qemu-devel@nongnu.org; Mon, 19 May 2014 13:15:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmR9e-0000ac-Go for qemu-devel@nongnu.org; Mon, 19 May 2014 13:15:14 -0400 Message-ID: <537A3C1F.8040602@redhat.com> Date: Mon, 19 May 2014 11:15:11 -0600 From: Eric Blake MIME-Version: 1.0 References: <1400518658-2515-1-git-send-email-armbru@redhat.com> <1400518658-2515-3-git-send-email-armbru@redhat.com> In-Reply-To: <1400518658-2515-3-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="b8jFxAxMQiWcc1oLq8E2BlorQJCiAfasV" Subject: Re: [Qemu-devel] [PATCH v2 2/5] char: Clean up fragile use of error_is_set() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, kraxel@redhat.com, aliguori@amazon.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --b8jFxAxMQiWcc1oLq8E2BlorQJCiAfasV Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/19/2014 10:57 AM, Markus Armbruster wrote: > Using error_is_set(ERRP) to find out whether a function failed is > either wrong, fragile, or unnecessarily opaque. It's wrong when ERRP > may be null, because errors go undetected when it is. It's fragile > when proving ERRP non-null involves a non-local argument. Else, it's > unnecessarily opaque (see commit 84d18f0). >=20 > The error_is_set(errp) in qemu_chr_new_from_opts() is merely fragile, > because the callers never pass a null errp argument. >=20 > Make the code more robust and more obviously correct: receive the > error in a local variable, then propagate it through the parameter. >=20 > Signed-off-by: Markus Armbruster > --- > qemu-char.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --b8jFxAxMQiWcc1oLq8E2BlorQJCiAfasV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTejwfAAoJEKeha0olJ0NqwmkH/jDpzG18tt7/wubobowcNQT9 1ElwG09idfFOpQ7q2s/TAQF2cPkYIqKH3qJkExgma262LWqx4+70dfRV9k3f2GSN N2wtRGRmex7nXhfzuyjg/1lzS4DyFYchgmns7bWWliUXI8sJr8Z6HJvkZwZV0Hf6 sPOQbN9gQeCmkFLX/48xPEuLvXkmR3UBcUP8IINha5f8EufA9F8TqurWbBmus09S EYftrXKDn9zJPYDjmA1Xa3XL40genKYwAZqNeLg0Dpa3rbb2Vz5A9vTM8KrODcMS YOGQDN5B7kS7rT39ocBZreRfN5490tKvwlNdlWbyw392WO3cVi5hfZ5/trrIQto= =Sfwc -----END PGP SIGNATURE----- --b8jFxAxMQiWcc1oLq8E2BlorQJCiAfasV--