diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index cc364fac2c..61cddc2b1d 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -817,7 +817,7 @@ static int hart_detect_features(struct sbi_scratch *scratch) } else { \ csr_write_allowed(__csr, &trap, __wrval); \ if (!trap.cause) { \ - if (csr_swap(__csr, oldval) == __wrval) \ + if ((csr_swap(__csr, oldval) & __wrval) == __wrval) \ (hfeatures->__field)++; \ else \ goto __skip; \