Re: [Qemu-devel] [PATCH 09/31] ioapic: Fix error handling in realize()

2018-10-09 Thread Marc-André Lureau
On Mon, Oct 8, 2018 at 9:35 PM Markus Armbruster  wrote:
>
> Calling error_report() in a function that takes an Error ** argument
> is suspicious.  ioapic_realize() does that, and then exit()s.
> Currently mostly harmless, as the device cannot be hot-plugged.
>
> Fixes: 20fd4b7b6d9282fe0cb83601f1821f31bd257458
> Cc: Peter Xu 
> Signed-off-by: Markus Armbruster 

Reviewed-by: Marc-André Lureau 

> ---
>  hw/intc/ioapic.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
> index b6896ac4ce..4e529729b4 100644
> --- a/hw/intc/ioapic.c
> +++ b/hw/intc/ioapic.c
> @@ -21,7 +21,7 @@
>   */
>
>  #include "qemu/osdep.h"
> -#include "qemu/error-report.h"
> +#include "qapi/error.h"
>  #include "monitor/monitor.h"
>  #include "hw/hw.h"
>  #include "hw/i386/pc.h"
> @@ -393,9 +393,9 @@ static void ioapic_realize(DeviceState *dev, Error **errp)
>  IOAPICCommonState *s = IOAPIC_COMMON(dev);
>
>  if (s->version != 0x11 && s->version != 0x20) {
> -error_report("IOAPIC only supports version 0x11 or 0x20 "
> - "(default: 0x%x).", IOAPIC_VER_DEF);
> -exit(1);
> +error_setg(errp, "IOAPIC only supports version 0x11 or 0x20 "
> +   "(default: 0x%x).", IOAPIC_VER_DEF);
> +return;
>  }
>
>  memory_region_init_io(>io_memory, OBJECT(s), _io_ops, s,
> --
> 2.17.1
>
>


-- 
Marc-André Lureau



Re: [Qemu-devel] [PATCH 09/31] ioapic: Fix error handling in realize()

2018-10-08 Thread Peter Xu
On Mon, Oct 08, 2018 at 07:31:03PM +0200, Markus Armbruster wrote:
> Calling error_report() in a function that takes an Error ** argument
> is suspicious.  ioapic_realize() does that, and then exit()s.
> Currently mostly harmless, as the device cannot be hot-plugged.
> 
> Fixes: 20fd4b7b6d9282fe0cb83601f1821f31bd257458
> Cc: Peter Xu 
> Signed-off-by: Markus Armbruster 

Reviewed-by: Peter Xu 

-- 
Peter Xu



[Qemu-devel] [PATCH 09/31] ioapic: Fix error handling in realize()

2018-10-08 Thread Markus Armbruster
Calling error_report() in a function that takes an Error ** argument
is suspicious.  ioapic_realize() does that, and then exit()s.
Currently mostly harmless, as the device cannot be hot-plugged.

Fixes: 20fd4b7b6d9282fe0cb83601f1821f31bd257458
Cc: Peter Xu 
Signed-off-by: Markus Armbruster 
---
 hw/intc/ioapic.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index b6896ac4ce..4e529729b4 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -21,7 +21,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/error-report.h"
+#include "qapi/error.h"
 #include "monitor/monitor.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
@@ -393,9 +393,9 @@ static void ioapic_realize(DeviceState *dev, Error **errp)
 IOAPICCommonState *s = IOAPIC_COMMON(dev);
 
 if (s->version != 0x11 && s->version != 0x20) {
-error_report("IOAPIC only supports version 0x11 or 0x20 "
- "(default: 0x%x).", IOAPIC_VER_DEF);
-exit(1);
+error_setg(errp, "IOAPIC only supports version 0x11 or 0x20 "
+   "(default: 0x%x).", IOAPIC_VER_DEF);
+return;
 }
 
 memory_region_init_io(>io_memory, OBJECT(s), _io_ops, s,
-- 
2.17.1