irqchip/gic-v3-its: Gracefully fail on LPI exhaustion
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 29 Jan 2019 15:19:23 +0000 (15:19 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 29 Jan 2019 15:48:51 +0000 (15:48 +0000)
In the unlikely event that we cannot find any available LPI in the
system, we should gracefully return an error instead of carrying
on with no LPI allocated at all.

Fixes: 38dd7c494cf6 ("irqchip/gic-v3-its: Drop chunk allocation compatibility")
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic-v3-its.c

index f25ec92f23ee25651c8008f2ed3614827dfbc561..c3aba3fc818d3c190166e07c8179dee5832b46bc 100644 (file)
@@ -1586,6 +1586,9 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids)
                nr_irqs /= 2;
        } while (nr_irqs > 0);
 
+       if (!nr_irqs)
+               err = -ENOSPC;
+
        if (err)
                goto out;