From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VltgM-0004ym-Af for qemu-devel@nongnu.org; Wed, 27 Nov 2013 23:58:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VltgH-0007Ye-En for qemu-devel@nongnu.org; Wed, 27 Nov 2013 23:58:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VltgH-0007Y8-4B for qemu-devel@nongnu.org; Wed, 27 Nov 2013 23:58:25 -0500 Message-ID: <5296CD6A.1060008@redhat.com> Date: Wed, 27 Nov 2013 21:58:18 -0700 From: Eric Blake MIME-Version: 1.0 References: <1385601858-8065-1-git-send-email-imammedo@redhat.com> In-Reply-To: <1385601858-8065-1-git-send-email-imammedo@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IfD8BtlVao3jeVLBvHiwqnpgLOTVwnS0U" Subject: Re: [Qemu-devel] [PATCH] qom: abort on error in property setter if caller passed errp == NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, peter.crosthwaite@xilinx.com, afaerber@suse.de, anthony@codemonkey.ws, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --IfD8BtlVao3jeVLBvHiwqnpgLOTVwnS0U Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/27/2013 06:24 PM, Igor Mammedov wrote: > in case if caller setting property doesn't care about error and > passes in NULL as errp argument but error occurs in property setter, > it is silently discarded leaving object in undefined state. >=20 > As result it leads to hard to find bugs, so if caller doesn't > care about error it must be sure that property exists and > accepts provided value, otherwise it's better to abort early > since error case couldn't be handled gracefully and find > invalid usecase early. >=20 > In addition multitude of property setters will be always > guarantied to have error object present and won't be required s/guarantied/guaranteed/ > to handle this condition individually. >=20 > Signed-off-by: Igor Mammedov > --- > +out: > + if (local_error) { This says local_error was set... > + if (!errp) { > + assert_no_error(local_error); so this assert_no_error() is dead code in its current position. To be useful, you probably want: if (!errp) { assert_no_error(local_error); } else if (local_error) { error_propagate(errp, local_error); } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --IfD8BtlVao3jeVLBvHiwqnpgLOTVwnS0U 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.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSls1qAAoJEKeha0olJ0NqwwIIAK4rWTTfVMWYPOOfBqhQ+wi9 wOSlmoVYjIpVVxhgGxm/npfB+5GATThSU6Ze7m6CpxbSRJfWnzIYw2NxG/zyLUVL SfWsCV+A2nUeKB3EyEm7Ux4Nc+5NOW4+kdJVwboE1r0EJRRD6j/ZXGqHKxG3Rfyf hTVTgW4tqaSSg/cDpUB6cfbPZFYeta9IgbjWesvLrEG1wmUXF1ht+z22qHMweu8e rLvItrH1rv281faADdxSnTdpezQUIRszCnHiERYQAO+EHzSNSYRm5bBPMX813l8R zC+wouGf7MLJ7SEqYMYID5UBlMHcSJSNZYHEzbdplN9I1oerjjpIKwifRM8Iuiw= =Gt6C -----END PGP SIGNATURE----- --IfD8BtlVao3jeVLBvHiwqnpgLOTVwnS0U--