[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH 08/11] pseries: Clean up error handling in spapr_r
From: |
Thomas Huth |
Subject: |
Re: [Qemu-ppc] [PATCH 08/11] pseries: Clean up error handling in spapr_rtas_register() |
Date: |
Fri, 11 Dec 2015 11:06:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 11/12/15 01:11, David Gibson wrote:
> The errors detected in this function indicate problems with the rest of
> the machine type code, rather than configuration or runtime problems.
>
> Use error_setg() and &error_abort instead of explicit fprintf() and exit().
>
> Signed-off-by: David Gibson <address@hidden>
> ---
> hw/ppc/spapr_rtas.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 34b12a3..db4a675 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -649,15 +649,14 @@ 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);
> + error_setg(&error_abort, "RTAS invalid token 0x%x", token);
> }
>
> token -= RTAS_TOKEN_BASE;
> if (rtas_table[token].name) {
> - fprintf(stderr, "RTAS call \"%s\" is registered already as 0x%x\n",
> - rtas_table[token].name, token);
> - exit(1);
> + error_setg(&error_abort,
> + "RTAS call \"%s\" is registered already as 0x%x",
> + rtas_table[token].name, token);
> }
As with the last patch, I also think these error_setg(&error_abort, ...)
are rather ugly. Maybe use error_report() + abort() instead?
Thomas
- [Qemu-ppc] [PATCH 00/11] Error handling cleanups for pseries machine type, David Gibson, 2015/12/10
- [Qemu-ppc] [PATCH 04/11] pseries: Clean up error handling in spapr_validate_node_memory(), David Gibson, 2015/12/10
- [Qemu-ppc] [PATCH 08/11] pseries: Clean up error handling in spapr_rtas_register(), David Gibson, 2015/12/10
- Re: [Qemu-ppc] [PATCH 08/11] pseries: Clean up error handling in spapr_rtas_register(),
Thomas Huth <=
- [Qemu-ppc] [PATCH 11/11] pseries: Clean up error reporting in htab migration functions, David Gibson, 2015/12/10
- [Qemu-ppc] [PATCH 02/11] pseries: Cleanup error handling of spapr_cpu_init(), David Gibson, 2015/12/10
- [Qemu-ppc] [PATCH 06/11] pseries: Improve error handling in find_unknown_sysbus_device(), David Gibson, 2015/12/10