[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 03/18] spapr: sanitize error handling in spapr_ics_crea
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 03/18] spapr: sanitize error handling in spapr_ics_create() |
Date: |
Thu, 25 May 2017 13:51:17 +1000 |
From: Greg Kurz <address@hidden>
The spapr_ics_create() function handles errors in a rather convoluted
way, with two local Error * variables. Moreover, failing to parent the
ICS object to the machine should be considered as a bug but it is
currently ignored.
This patch addresses both issues.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 18709ad..a9471b9 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -101,21 +101,26 @@ static ICSState *spapr_ics_create(sPAPRMachineState
*spapr,
const char *type_ics,
int nr_irqs, Error **errp)
{
- Error *err = NULL, *local_err = NULL;
+ Error *local_err = NULL;
Object *obj;
obj = object_new(type_ics);
- object_property_add_child(OBJECT(spapr), "ics", obj, NULL);
+ object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
object_property_add_const_link(obj, "xics", OBJECT(spapr), &error_abort);
- object_property_set_int(obj, nr_irqs, "nr-irqs", &err);
+ object_property_set_int(obj, nr_irqs, "nr-irqs", &local_err);
+ if (local_err) {
+ goto error;
+ }
object_property_set_bool(obj, true, "realized", &local_err);
- error_propagate(&err, local_err);
- if (err) {
- error_propagate(errp, err);
- return NULL;
+ if (local_err) {
+ goto error;
}
return ICS_SIMPLE(obj);
+
+error:
+ error_propagate(errp, local_err);
+ return NULL;
}
static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)
--
2.9.4
- [Qemu-ppc] [PULL 04/18] spapr-cpu-core: release ICP object when realization fails, (continued)
- [Qemu-ppc] [PULL 04/18] spapr-cpu-core: release ICP object when realization fails, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 10/18] spapr: fix error reporting in xics_system_init(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 08/18] hw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 07/18] spapr: ensure core_slot isn't NULL in spapr_core_unplug(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 09/18] spapr_cpu_core: drop reference on ICP object during CPU realization, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 06/18] xics_kvm: cache already enabled vCPU ids, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 13/18] spapr: add pre_plug function for memory, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 11/18] pseries: Split CAS PVR negotiation out into a separate function, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 14/18] hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 03/18] spapr: sanitize error handling in spapr_ics_create(),
David Gibson <=
- [Qemu-ppc] [PULL 05/18] spapr: Consolidate HPT freeing code into a routine, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 18/18] xics: add unrealize handler, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 15/18] hw/ppc: removing drc->detach_cb and drc->detach_cb_opaque, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 12/18] pseries: Restore support for total vcpus not a multiple of threads-per-core for old machine types, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 17/18] hw/ppc/spapr.c: recover pending LMB unplug info in spapr_lmb_release, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 16/18] hw/ppc: migrating the DRC state of hotplugged devices, David Gibson, 2017/05/24
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/18] ppc-for-2.10 queue 20170525, Stefan Hajnoczi, 2017/05/30