[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 14/28] pseries: Clean up error handling in spapr_vga_in
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 14/28] pseries: Clean up error handling in spapr_vga_init() |
Date: |
Mon, 25 Jan 2016 12:15:13 +1100 |
Use error_setg() to return an error rather than an explicit exit().
Previously it was an exit(0) instead of a non-zero exit code, which was
simply a bug. Also improve the error message.
While we're at it change the type of spapr_vga_init() to bool since that's
how we're using it anyway.
Signed-off-by: David Gibson <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Alexey Kardashevskiy <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
hw/ppc/spapr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 5793205..c04666d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1245,7 +1245,7 @@ static void spapr_rtc_create(sPAPRMachineState *spapr)
}
/* Returns whether we want to use VGA or not */
-static int spapr_vga_init(PCIBus *pci_bus)
+static bool spapr_vga_init(PCIBus *pci_bus, Error **errp)
{
switch (vga_interface_type) {
case VGA_NONE:
@@ -1256,9 +1256,9 @@ static int spapr_vga_init(PCIBus *pci_bus)
case VGA_VIRTIO:
return pci_vga_init(pci_bus) != NULL;
default:
- fprintf(stderr, "This vga model is not supported,"
- "currently it only supports -vga std\n");
- exit(0);
+ error_setg(errp,
+ "Unsupported VGA mode, only -vga std or -vga virtio is
supported");
+ return false;
}
}
@@ -1933,7 +1933,7 @@ static void ppc_spapr_init(MachineState *machine)
}
/* Graphics */
- if (spapr_vga_init(phb->bus)) {
+ if (spapr_vga_init(phb->bus, &error_fatal)) {
spapr->has_graphics = true;
machine->usb |= defaults_enabled() && !machine->usb_disabled;
}
--
2.5.0
- [Qemu-ppc] [PULL 02/28] target-ppc: use cpu_write_xer() helper in cpu_post_load, (continued)
- [Qemu-ppc] [PULL 02/28] target-ppc: use cpu_write_xer() helper in cpu_post_load, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 10/28] spapr: Don't create ibm, dynamic-reconfiguration-memory w/o DR LMBs, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 16/28] pseries: Clean up error handling in xics_system_init(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 18/28] pseries: Clean up error reporting in htab migration functions, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 06/28] cuda: add missing fields to VMStateDescription, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 19/28] target-ppc: kvm: fix floating point registers sync on little-endian hosts, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 13/28] pseries: Clean up error handling in spapr_validate_node_memory(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 22/28] target-ppc: gdbstub: introduce avr_need_swap(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 12/28] pseries: Clean up error handling of spapr_cpu_init(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 11/28] ppc: Clean up error handling in ppc_set_compat(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 14/28] pseries: Clean up error handling in spapr_vga_init(),
David Gibson <=
- [Qemu-ppc] [PULL 27/28] cuda.c: return error for unknown commands, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 20/28] target-ppc: rename and export maybe_bswap_register(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 08/28] spapr: Remove rtas_st_buffer_direct(), David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 28/28] uninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 07/28] spapr: Small fixes to rtas_ibm_get_system_parameter, remove rtas_st_buffer, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 23/28] target-ppc: gdbstub: fix altivec registers for little-endian guests, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 24/28] target-ppc: gdbstub: fix spe registers for little-endian guests, David Gibson, 2016/01/24
- [Qemu-ppc] [PULL 25/28] target-ppc: gdbstub: Add VSX support, David Gibson, 2016/01/24
- Re: [Qemu-ppc] [PULL 00/28] ppc-for-2.6 queue 20160125, Peter Maydell, 2016/01/25