[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/11] pseries: Cleanup error handling in spapr_
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH 07/11] pseries: Cleanup error handling in spapr_kvm_type() |
Date: |
Fri, 11 Dec 2015 11:01:37 +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:
> Use error_setg() and &error_fatal instead of an explicit exit().
>
> Signed-off-by: David Gibson <address@hidden>
> ---
> hw/ppc/spapr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index fd16db4..546d2f5 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2035,8 +2035,8 @@ static int spapr_kvm_type(const char *vm_type)
> return 2;
> }
>
> - error_report("Unknown kvm-type specified '%s'", vm_type);
> - exit(1);
> + error_setg(&error_fatal, "Unknown kvm-type specified '%s'", vm_type);
> + return 0;
> }
Honestly, I'd rather prefer the original code here. error_setg() should
IMHO be used to set an error in an "flexible" error variable. Using it
with an "hard-coded" error_fatal sounds ugly to me. And as far as I can
see, no other code in QEMU uses error_setg(&error_fatal, ...) - so we
should maybe not start with this in the spapr code as well.
If you still would like to get rid of the exit() here ... maybe you
could introduce some kind of error_report_fatal() function instead that
exits after reporting the error with error_report() ?
Thomas
- [Qemu-devel] [PATCH 09/11] pseries: Clean up error handling in xics_system_init(), (continued)
- [Qemu-devel] [PATCH 09/11] pseries: Clean up error handling in xics_system_init(), David Gibson, 2015/12/10
- [Qemu-devel] [PATCH 10/11] pseries: Clean up error handling in ppc_spapr_init(), David Gibson, 2015/12/10
- [Qemu-devel] [PATCH 03/11] pseries: Clean up hash page table allocation error handling, David Gibson, 2015/12/10
- [Qemu-devel] [PATCH 07/11] pseries: Cleanup error handling in spapr_kvm_type(), David Gibson, 2015/12/10
- Re: [Qemu-devel] [PATCH 07/11] pseries: Cleanup error handling in spapr_kvm_type(),
Thomas Huth <=
- [Qemu-devel] [PATCH 06/11] pseries: Improve error handling in find_unknown_sysbus_device(), David Gibson, 2015/12/10
- [Qemu-devel] [PATCH 01/11] ppc: Cleanup error handling in ppc_set_compat(), David Gibson, 2015/12/10