Interrupt source 0 is reserved. Hence the irq should start from 1.
Fixes:
2b79b694a805 ("lib: irqchip/plic: Add priority save/restore helpers")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Anup Patel <anup@brainfault.org>
void plic_priority_save(const struct plic_data *plic, u8 *priority)
{
- for (u32 i = 0; i < plic->num_src; i++)
+ for (u32 i = 1; i <= plic->num_src; i++)
priority[i] = plic_get_priority(plic, i);
}
void plic_priority_restore(const struct plic_data *plic, const u8 *priority)
{
- for (u32 i = 0; i < plic->num_src; i++)
+ for (u32 i = 1; i <= plic->num_src; i++)
plic_set_priority(plic, i, priority[i]);
}