diff mbox series

[v2,1/2] target/riscv: Remove redundant check in pmp_is_locked

Message ID 20230704023811.4355-1-reaperlu@hust.edu.cn
State New
Headers show
Series [v2,1/2] target/riscv: Remove redundant check in pmp_is_locked | expand

Commit Message

Ruibo Lu July 4, 2023, 2:33 a.m. UTC
the check of top PMP is redundant and will not influence the return
value, so consider remove it

Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Ruibo Lu <reaperlu@hust.edu.cn>
---
 target/riscv/pmp.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Daniel Henrique Barboza July 7, 2023, 7:31 p.m. UTC | #1
On 7/3/23 23:33, Ruibo Lu wrote:
> the check of top PMP is redundant and will not influence the return
> value, so consider remove it
> 
> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Ruibo Lu <reaperlu@hust.edu.cn>
> ---

I believe we might want to add:

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1733



>   target/riscv/pmp.c | 5 -----
>   1 file changed, 5 deletions(-)
> 
> diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
> index 9d8db493e6..1a9279ba88 100644
> --- a/target/riscv/pmp.c
> +++ b/target/riscv/pmp.c
> @@ -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;
>   }
>
diff mbox series

Patch

diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index 9d8db493e6..1a9279ba88 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -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;
 }