Skip to contentSkip to conversation

target/riscv: Remove redundant check in pmp_is_locked

PATCH In review Ruibo Lu 3 participants 3 messages Jun 28, 2023 – Jul 3, 2023 RISC-V

lore
Share & tools
lore

Ruibo Lu

author
#0 lore raw

PATCH 1/2 target/riscv: Remove redundant check in pmp_is_locked

the check of top PMP is redundant and will not influence the return value, so consider remove it

---
 target/riscv/pmp.c | 5 -----
 1 file changed, 5 deletions(-)
target/riscv/pmp.c +0 -5
index 9d8db493e6..1a9279ba88 100644
@@ -49,11 +49,6 @@ static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
         return 1;
     }
 
-    /* Top PMP has no 'next' to check */
-    if ((pmp_index + 1u) >= MAX_RISCV_PMPS) {
-        return 0;
-    }
-
     return 0;
 }
 
Signature · 1 line
2.41.0
Reviewed-by on v1 1/2
#1 lore raw
Quoted 5 lines · Ruibo Lu

the check of top PMP is redundant and will not influence the return value, so consider remove it

---

Weiwei Li

Quoted 19 lines
  target/riscv/pmp.c | 5 -----
  1 file changed, 5 deletions(-)
target/riscv/pmp.c +0 -5
index 9d8db493e6..1a9279ba88 100644
@@ -49,11 +49,6 @@ static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
          return 1;
      }
 
-    /* Top PMP has no 'next' to check */
-    if ((pmp_index + 1u) >= MAX_RISCV_PMPS) {
-        return 0;
-    }
-
      return 0;
  }
 
Reviewed-by on v1 1/2
#2 lore raw
In reply to Ruibo Lu
Quoted 5 lines · Ruibo Lu

the check of top PMP is redundant and will not influence the return value, so consider remove it

Alistair

Quoted 24 lines
---
 target/riscv/pmp.c | 5 -----
 1 file changed, 5 deletions(-)
target/riscv/pmp.c +0 -6
index 9d8db493e6..1a9279ba88 100644
@@ -49,11 +49,6 @@ static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
         return 1;
     }
 
-    /* Top PMP has no 'next' to check */
-    if ((pmp_index + 1u) >= MAX_RISCV_PMPS) {
-        return 0;
-    }
-
     return 0;
 }
 
--

2.41.0