From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLfEj-0001f1-Fv for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:58:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLfEg-0000uD-AB for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:58:53 -0500 References: <1452859244-9500-1-git-send-email-david@gibson.dropbear.id.au> <1452859244-9500-8-git-send-email-david@gibson.dropbear.id.au> From: Eric Blake Message-ID: <569EBFA6.6090709@redhat.com> Date: Tue, 19 Jan 2016 15:58:46 -0700 MIME-Version: 1.0 In-Reply-To: <1452859244-9500-8-git-send-email-david@gibson.dropbear.id.au> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="e06Js9MtE1coigFNSRpA0i0AvOQLNXtvO" Subject: Re: [Qemu-devel] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , armbru@redhat.com Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --e06Js9MtE1coigFNSRpA0i0AvOQLNXtvO Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/15/2016 05:00 AM, David Gibson wrote: > The errors detected in this function necessarily indicate bugs in the r= est > of the qemu code, rather than an external or configuration problem. >=20 > So, a simple assert() is more appropriate than any more complex error > reporting. >=20 > Signed-off-by: David Gibson > --- > hw/ppc/spapr_rtas.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) >=20 > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > index 34b12a3..0be52ae 100644 > --- a/hw/ppc/spapr_rtas.c > +++ b/hw/ppc/spapr_rtas.c > @@ -648,17 +648,11 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPA= PRMachineState *spapr, > =20 > void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn= ) > { > - if (!((token >=3D RTAS_TOKEN_BASE) && (token < RTAS_TOKEN_MAX))) {= > - fprintf(stderr, "RTAS invalid token 0x%x\n", token); > - exit(1); > - } > + assert((token >=3D RTAS_TOKEN_BASE) && (token < RTAS_TOKEN_MAX)); You could drop the redundant () while touching this, as in: assert(token >=3D RTAS_TOKEN_BASE && token < RTAS_TOKEN_MAX); --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --e06Js9MtE1coigFNSRpA0i0AvOQLNXtvO 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/ iQEcBAEBCAAGBQJWnr+mAAoJEKeha0olJ0Nq1RkH/isCWE27Ewr6JfnWukHHiOKJ YA3OlB8YtQSv/txg/WNIxaUp5lN67CN9nzetIMb6BRAqDVGgA/nsksVvkaa3pdcL iosIvihJp8muBzzP1rnBgHzVAnd3dhARhuMV700YVCHQnJGv2XZwqi2yTU0GOZ5P aETQUwB2NLEOa6KfbLO6rOpoGVXcG/kbhHvL4Jl1X5HeHIk3ydI9k6JXWO2Too0V 9X9IA7nJz9npvrDV80dr2yRp+C3xa8E212MwEbfP0eTz3Iqg0/xqeCq3Sf+x+t9Y KRbuvZyxZrErCbSSErKyRuAlrVGsJdqgQ9lzNk8SepndF98X3xR38C0AMJSUhkg= =HU5S -----END PGP SIGNATURE----- --e06Js9MtE1coigFNSRpA0i0AvOQLNXtvO--