pmpcfg_csr and pmpcfg_shift are only negative for an unexpected value of
__riscv_xlen. We can immediately return in this case.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Dong Du <Dd_nirvana@sjtu.edu.cn>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
pmpcfg_csr = (CSR_PMPCFG0 + (n >> 2)) & ~1;
pmpcfg_shift = (n & 7) << 3;
#else
- pmpcfg_csr = -1;
- pmpcfg_shift = -1;
+ return SBI_ENOTSUPP;
#endif
pmpaddr_csr = CSR_PMPADDR0 + n;
- if (pmpcfg_csr < 0 || pmpcfg_shift < 0)
- return SBI_ENOTSUPP;
/* encode PMP config */
prot &= ~PMP_A;
pmpcfg_csr = (CSR_PMPCFG0 + (n >> 2)) & ~1;
pmpcfg_shift = (n & 7) << 3;
#else
- pmpcfg_csr = -1;
- pmpcfg_shift = -1;
+ return SBI_ENOTSUPP;
#endif
pmpaddr_csr = CSR_PMPADDR0 + n;
- if (pmpcfg_csr < 0 || pmpcfg_shift < 0)
- return SBI_ENOTSUPP;
/* decode PMP config */
cfgmask = (0xffUL << pmpcfg_shift);