summaryrefslogtreecommitdiff
path: root/drivers/irqchip/irq-sifive-plic.c
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2019-02-12 03:10:11 -0800
committerMarc Zyngier <marc.zyngier@arm.com>2019-02-14 12:24:34 +0000
commitfc03acaeab358c008a194b78daa10e78401376a8 (patch)
tree4bb054bda7e8fc7cdfc53d7fbf39999149bfcfd7 /drivers/irqchip/irq-sifive-plic.c
parent518bfe84ec417318b2470652cdb27978ddfeaa59 (diff)
downloadlinux-next-fc03acaeab358c008a194b78daa10e78401376a8.tar.gz
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>
Diffstat (limited to 'drivers/irqchip/irq-sifive-plic.c')
-rw-r--r--drivers/irqchip/irq-sifive-plic.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 357e9daf94ae..254ecd76e8be 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -237,6 +237,11 @@ static int __init plic_init(struct device_node *node,
}
cpu = riscv_hartid_to_cpuid(hartid);
+ if (cpu < 0) {
+ pr_warn("Invalid cpuid for context %d\n", i);
+ continue;
+ }
+
handler = per_cpu_ptr(&plic_handlers, cpu);
handler->present = true;
handler->ctxid = i;