Skip to content

Commit fc03aca

Browse files
atishp04Marc Zyngier
authored andcommitted
irqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid.
riscv_hartid_to_cpuid can return invalid cpuid for a hart that is present in DT but was never brought up. Print the appropriate warning message and continue. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 518bfe8 commit fc03aca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/irqchip/irq-sifive-plic.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ static int __init plic_init(struct device_node *node,
237237
}
238238

239239
cpu = riscv_hartid_to_cpuid(hartid);
240+
if (cpu < 0) {
241+
pr_warn("Invalid cpuid for context %d\n", i);
242+
continue;
243+
}
244+
240245
handler = per_cpu_ptr(&plic_handlers, cpu);
241246
handler->present = true;
242247
handler->ctxid = i;

0 commit comments

Comments
 (0)