riscv: Fix crash during early errata patching