riscv: Fix PLIC -Wunused-but-set-variable warnings
(cherry picked from commit 434cb1c4a6316d0966b5cd029e6ae40d5b944406)