ics_valid_irq() can be replaced by a simple check on the 'srcno' number. It also removes a dependency on the ICSState object of the sPAPR machine.
Signed-off-by: Cédric Le Goater <c...@kaod.org> --- hw/ppc/spapr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6c3fc12ed8e1..0c6a4c8bffc0 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3619,11 +3619,10 @@ static int spapr_irq_alloc_block(XICSFabric *xi, int count, int align) static void spapr_irq_free_block(XICSFabric *xi, int irq, int num) { sPAPRMachineState *spapr = SPAPR_MACHINE(xi); - ICSState *ics = spapr->ics; int srcno = irq - spapr->irq_base; int i; - if (ics_valid_irq(ics, irq)) { + if (srcno >= 0 && srcno < spapr->nr_irqs) { trace_spapr_irq_free(0, irq, num); for (i = srcno; i < srcno + num; ++i) { if (!test_bit(i, spapr->irq_map)) { -- 2.13.6