From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Eric Blake <eblake@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
armbru@redhat.com
Cc: qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register()
Date: Wed, 20 Jan 2016 11:21:49 +1100 [thread overview]
Message-ID: <569ED31D.1020307@ozlabs.ru> (raw)
In-Reply-To: <569EBFA6.6090709@redhat.com>
On 01/20/2016 09:58 AM, Eric Blake wrote:
> On 01/15/2016 05:00 AM, David Gibson wrote:
>> The errors detected in this function necessarily indicate bugs in the rest
>> of the qemu code, rather than an external or configuration problem.
>>
>> So, a simple assert() is more appropriate than any more complex error
>> reporting.
>>
>> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
>> ---
>> hw/ppc/spapr_rtas.c | 12 +++---------
>> 1 file changed, 3 insertions(+), 9 deletions(-)
>>
>> 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, sPAPRMachineState *spapr,
>>
>> void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn)
>> {
>> - if (!((token >= RTAS_TOKEN_BASE) && (token < RTAS_TOKEN_MAX))) {
>> - fprintf(stderr, "RTAS invalid token 0x%x\n", token);
>> - exit(1);
>> - }
>> + assert((token >= RTAS_TOKEN_BASE) && (token < RTAS_TOKEN_MAX));
>
> You could drop the redundant () while touching this, as in:
Seriously? Why? I personally find it really annoying (but I stay silent)
when people omit braces in cases like this.
> assert(token >= RTAS_TOKEN_BASE && token < RTAS_TOKEN_MAX);
>
--
Alexey
next prev parent reply other threads:[~2016-01-20 0:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 12:00 [Qemu-devel] [PATCH 00/10] Cleanups to error reporting on ppc and spapr (v2) David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 01/10] ppc: Cleanup error handling in ppc_set_compat() David Gibson
2016-01-15 15:19 ` Markus Armbruster
2016-01-17 9:32 ` David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 02/10] pseries: Cleanup error handling of spapr_cpu_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 03/10] pseries: Clean up hash page table allocation error handling David Gibson
2016-01-18 2:44 ` Alexey Kardashevskiy
2016-01-18 4:42 ` David Gibson
2016-01-18 5:17 ` Alexey Kardashevskiy
2016-01-18 5:35 ` David Gibson
2016-01-18 6:04 ` Alexey Kardashevskiy
2016-01-18 8:17 ` David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 04/10] pseries: Clean up error handling in spapr_validate_node_memory() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 05/10] pseries: Cleanup error handling in spapr_vga_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 06/10] pseries: Improve error handling in find_unknown_sysbus_device() David Gibson
2016-01-15 15:40 ` Markus Armbruster
2016-01-18 2:50 ` David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 07/10] pseries: Clean up error handling in spapr_rtas_register() David Gibson
2016-01-19 22:58 ` Eric Blake
2016-01-20 0:21 ` Alexey Kardashevskiy [this message]
2016-01-20 4:53 ` Eric Blake
2016-01-20 5:53 ` Alexey Kardashevskiy
2016-01-20 10:08 ` Thomas Huth
2016-01-20 7:18 ` Markus Armbruster
2016-01-20 8:15 ` Alexey Kardashevskiy
2016-01-20 9:27 ` Markus Armbruster
2016-01-15 12:00 ` [Qemu-devel] [PATCH 08/10] pseries: Clean up error handling in xics_system_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 09/10] pseries: Clean up error reporting in ppc_spapr_init() David Gibson
2016-01-15 12:00 ` [Qemu-devel] [PATCH 10/10] pseries: Clean up error reporting in htab migration functions David Gibson
2016-01-15 15:47 ` [Qemu-devel] [PATCH 00/10] Cleanups to error reporting on ppc and spapr (v2) Markus Armbruster
2016-01-16 13:15 ` David Gibson
2016-01-17 23:56 ` Alexey Kardashevskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=569ED31D.1020307@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).