diff mbox series

[3/3] target/loongarch: Remove unnecessary temporary variable assignment

Message ID 20250313091350.3770394-4-maobibo@loongson.cn (mailing list archive)
State New
Headers show
Series target/loongarch: Solve some issues reported from coccinelle | expand

Commit Message

bibo mao March 13, 2025, 9:13 a.m. UTC
Temporary variable ret is assigned at last line and return, it can
be removed and return directly.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 target/loongarch/tcg/tlb_helper.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Markus Armbruster March 13, 2025, 10:33 a.m. UTC | #1
Bibo Mao <maobibo@loongson.cn> writes:

> Temporary variable ret is assigned at last line and return, it can
> be removed and return directly.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Philippe Mathieu-Daudé March 13, 2025, 10:41 a.m. UTC | #2
On 13/3/25 10:13, Bibo Mao wrote:
> Temporary variable ret is assigned at last line and return, it can
> be removed and return directly.
> 
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   target/loongarch/tcg/tlb_helper.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
index 646dbf59de..182881a237 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -543,7 +543,7 @@  target_ulong helper_lddir(CPULoongArchState *env, target_ulong base,
                           target_ulong level, uint32_t mem_idx)
 {
     CPUState *cs = env_cpu(env);
-    target_ulong badvaddr, index, phys, ret;
+    target_ulong badvaddr, index, phys;
     uint64_t dir_base, dir_width;
 
     if (unlikely((level == 0) || (level > 4))) {
@@ -571,8 +571,7 @@  target_ulong helper_lddir(CPULoongArchState *env, target_ulong base,
     get_dir_base_width(env, &dir_base, &dir_width, level);
     index = (badvaddr >> dir_base) & ((1 << dir_width) - 1);
     phys = base | index << 3;
-    ret = ldq_phys(cs->as, phys) & TARGET_PHYS_MASK;
-    return ret;
+    return ldq_phys(cs->as, phys) & TARGET_PHYS_MASK;
 }
 
 void helper_ldpte(CPULoongArchState *env, target_ulong base, target_ulong odd,