summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Meng <bmeng@tinylab.org>2022-12-11 09:54:22 +0300
committerAnup Patel <anup@brainfault.org>2022-12-17 06:30:35 +0300
commit91c8a7d5cef1e9729c1c2bad549ebc69afeadb3b (patch)
treec4f7c0871e94caf31dab3406838a4de0090a54d5
parent8509e46ca63a4ed7dff2244cd7f288bf5591ab61 (diff)
downloadopensbi-91c8a7d5cef1e9729c1c2bad549ebc69afeadb3b.tar.xz
lib: utils/irqchip: plic: Fix the off-by-one error in plic_context_init()
The number of interrupt enable register in words was once correct, but was wrongly changed to have an off-by-one error since commit 8c362e7d065e ("lib: irqchip/plic: Factor out a context init function"). Fixes: 8c362e7d065e ("lib: irqchip/plic: Factor out a context init function") Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Samuel Holland <samuel@sholland.org>
-rw-r--r--lib/utils/irqchip/plic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c
index c5c1879..5b87d3b 100644
--- a/lib/utils/irqchip/plic.c
+++ b/lib/utils/irqchip/plic.c
@@ -121,7 +121,7 @@ int plic_context_init(const struct plic_data *plic, int context_id,
if (!plic || context_id < 0)
return SBI_EINVAL;
- ie_words = (plic->num_src + 31) / 32;
+ ie_words = plic->num_src / 32 + 1;
ie_value = enable ? 0xffffffffU : 0U;
for (u32 i = 0; i < ie_words; i++)