aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2019-03-21 15:49:11 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2019-04-26 10:41:23 +1000
commitf56275a2fc4b627604c71e5833bd357ee9b6ecbb (patch)
treef00d94bdaad8a2c562b9336fad0c4a625ea2f892 /hw
parent64db6c70dc5d41cb7ad0c6c9d7a81a905a0d321b (diff)
downloadqemu-f56275a2fc4b627604c71e5833bd357ee9b6ecbb.zip
qemu-f56275a2fc4b627604c71e5833bd357ee9b6ecbb.tar.gz
qemu-f56275a2fc4b627604c71e5833bd357ee9b6ecbb.tar.bz2
spapr/irq: remove spapr_ics_create()
spapr_ics_create() is only called once. Merge it in spapr_irq_init_xics() and simplify a bit the error handling by using 'error_fatal' . Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20190321144914.19934-13-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppc/spapr_irq.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 0a84e4c..b1f79ea 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -67,36 +67,11 @@ void spapr_irq_msi_reset(SpaprMachineState *spapr)
* XICS IRQ backend.
*/
-static ICSState *spapr_ics_create(SpaprMachineState *spapr,
- int nr_irqs, Error **errp)
-{
- Error *local_err = NULL;
- Object *obj;
-
- obj = object_new(TYPE_ICS_SIMPLE);
- object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
- object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
- &error_abort);
- 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);
- if (local_err) {
- goto error;
- }
-
- return ICS_BASE(obj);
-
-error:
- error_propagate(errp, local_err);
- return NULL;
-}
-
static void spapr_irq_init_xics(SpaprMachineState *spapr, int nr_irqs,
Error **errp)
{
MachineState *machine = MACHINE(spapr);
+ Object *obj;
Error *local_err = NULL;
bool xics_kvm = false;
@@ -108,7 +83,8 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr, int nr_irqs,
if (machine_kernel_irqchip_required(machine) && !xics_kvm) {
error_prepend(&local_err,
"kernel_irqchip requested but unavailable: ");
- goto error;
+ error_propagate(errp, local_err);
+ return;
}
error_free(local_err);
local_err = NULL;
@@ -118,10 +94,18 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr, int nr_irqs,
xics_spapr_init(spapr);
}
- spapr->ics = spapr_ics_create(spapr, nr_irqs, &local_err);
+ obj = object_new(TYPE_ICS_SIMPLE);
+ object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
+ object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
+ &error_fatal);
+ object_property_set_int(obj, nr_irqs, "nr-irqs", &error_fatal);
+ object_property_set_bool(obj, true, "realized", &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
-error:
- error_propagate(errp, local_err);
+ spapr->ics = ICS_BASE(obj);
}
#define ICS_IRQ_FREE(ics, srcno) \