diff options
author | Greg Kurz <groug@kaod.org> | 2018-04-11 19:46:06 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-04-27 18:05:22 +1000 |
commit | 1d36c75a9ebf6bddbdb46693052a48ef134f3699 (patch) | |
tree | 43c494c56da32e2ee4b329d666d9d6e1238de980 /hw/ppc | |
parent | 2b10808539d7ace3d9b1226a71a68e2431ef2176 (diff) | |
download | qemu-1d36c75a9ebf6bddbdb46693052a48ef134f3699.zip qemu-1d36c75a9ebf6bddbdb46693052a48ef134f3699.tar.gz qemu-1d36c75a9ebf6bddbdb46693052a48ef134f3699.tar.bz2 |
spapr: drop useless sanity check in spapr_irq_alloc*()
Both spapr_irq_alloc() and spapr_irq_alloc_block() have an errp
parameter, but they don't use it if XICS hasn't been initialized
yet.
This is doubly wrong:
- all callers do pass a non-null Error **, ie, they expect an error
to be propagated in case of failure
- XICS obviously needs to be initialized before anything starts allocating
IRQs
So this patch turns the check into an assert.
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b92dad2..5a1c1e2 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3719,9 +3719,8 @@ int spapr_irq_alloc(sPAPRMachineState *spapr, int irq_hint, bool lsi, ICSState *ics = spapr->ics; int irq; - if (!ics) { - return -1; - } + assert(ics); + if (irq_hint) { if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) { error_setg(errp, "can't allocate IRQ %d: already in use", irq_hint); @@ -3753,9 +3752,7 @@ int spapr_irq_alloc_block(sPAPRMachineState *spapr, int num, bool lsi, ICSState *ics = spapr->ics; int i, first = -1; - if (!ics) { - return -1; - } + assert(ics); /* * MSIMesage::data is used for storing VIRQ so |