[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/39] pseries: Clean up error handling in spapr_vga_
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 14/39] pseries: Clean up error handling in spapr_vga_init() |
Date: |
Fri, 29 Jan 2016 16:06:46 +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 b20b109..045c5a1 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-devel] [PULL 00/39] ppc-for-2.6 queue 20160129, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 00/39] ppc-for-2.6 queue 20160129, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 05/39] mac_dbdma: add DBDMA controller state to VMStateDescription, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 04/39] macio: add dma_active to VMStateDescription, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 01/39] target-ppc: Use sensible POWER8/POWER8E versions, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 12/39] pseries: Clean up error handling of spapr_cpu_init(), David Gibson, 2016/01/29
- [Qemu-devel] [PULL 14/39] pseries: Clean up error handling in spapr_vga_init(),
David Gibson <=
- [Qemu-devel] [PULL 23/39] target-ppc: gdbstub: fix altivec registers for little-endian guests, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 26/39] pseries: Allow TCG h_enter to work with hotplugged memory, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 11/39] ppc: Clean up error handling in ppc_set_compat(), David Gibson, 2016/01/29
- [Qemu-devel] [PULL 17/39] pseries: Clean up error reporting in ppc_spapr_init(), David Gibson, 2016/01/29
- [Qemu-devel] [PULL 33/39] target-ppc: Use actual page size encodings from HPTE, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 34/39] target-ppc: Remove unused mmu models from ppc_tlb_invalidate_one, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 06/39] cuda: add missing fields to VMStateDescription, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 15/39] pseries: Clean up error handling in spapr_rtas_register(), David Gibson, 2016/01/29
- [Qemu-devel] [PULL 10/39] spapr: Don't create ibm, dynamic-reconfiguration-memory w/o DR LMBs, David Gibson, 2016/01/29
- [Qemu-devel] [PULL 07/39] spapr: Small fixes to rtas_ibm_get_system_parameter, remove rtas_st_buffer, David Gibson, 2016/01/29