lib: sbi_irqchip: Check full range for existing handlers in sbi_irqchip_register_handler()

Currently, the sbi_irqchip_register_handler() only checks the first and the
last hardware interrupt for existing handlers which is buggy because there
may be existing handlers between the first and the last hardware interrupt.

Fixes: 0ab0c470d5 ("lib: sbi_irqchip: Allow registering interrupt handlers")
Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260423052339.356900-2-anup.patel@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Anup Patel
2026-04-23 10:53:34 +05:30
committed by Anup Patel
parent 9595829a33
commit 0d81a78ec5
+3 -4
View File
@@ -149,12 +149,11 @@ int sbi_irqchip_register_handler(struct sbi_irqchip_device *chip,
chip->num_hwirq <= (first_hwirq + num_hwirq - 1))
return SBI_EBAD_RANGE;
h = sbi_irqchip_find_handler(chip, first_hwirq);
if (h)
return SBI_EALREADY;
h = sbi_irqchip_find_handler(chip, first_hwirq + num_hwirq - 1);
for (i = first_hwirq; i < (first_hwirq + num_hwirq); i++) {
h = sbi_irqchip_find_handler(chip, i);
if (h)
return SBI_EALREADY;
}
h = sbi_zalloc(sizeof(*h));
if (!h)