Skip to content

Commit

Permalink
ioapic: Fix error handling in realize()
Browse files Browse the repository at this point in the history
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: 20fd4b7
Cc: Peter Xu <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
Markus Armbruster committed Oct 19, 2018
1 parent d319e05 commit 11ab69d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hw/intc/ioapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(&s->io_memory, OBJECT(s), &ioapic_io_ops, s,
Expand Down

0 comments on commit 11ab69d

Please sign in to comment.