Skip to contentSkip to conversation

bpf: Remove unneeded variable

PATCH In review [email protected] 2 participants 2 messages Jun 14, 2023 – Jun 16, 2023 2 messages not in the archive

Subsystems (5)
Networking Network drivers x86 BPF +1 more subsystems
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 bpf: Remove unneeded variable

Fix the following coccicheck warning:

arch/x86/net/bpf_jit_comp32.c:1274:5-8: Unneeded variable: "cnt".

---
 arch/x86/net/bpf_jit_comp32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/net/bpf_jit_comp32.c +1 -2
index 429a89c5468b..bc71329ac5ed 100644
@@ -1271,7 +1271,6 @@ static void emit_epilogue(u8 **pprog, u32 stack_depth)
 static int emit_jmp_edx(u8 **pprog, u8 *ip)
 {
     u8 *prog = *pprog;
-    int cnt = 0;
 
 #ifdef CONFIG_RETPOLINE
     EMIT1_off32(0xE9, (u8 *)__x86_indirect_thunk_edx - (ip + 5));
@@ -1280,7 +1279,7 @@ static int emit_jmp_edx(u8 **pprog, u8 *ip)
 #endif
     *pprog = prog;
 
-    return cnt;
+    return 0;
 }
 
 /*
#3 lore raw
Quoted 23 lines · On Tue, Jun 13, 2023 at 11:29 PM <[email protected]> wrote:

Fix the following coccicheck warning:

arch/x86/net/bpf_jit_comp32.c:1274:5-8: Unneeded variable: "cnt".

---
  arch/x86/net/bpf_jit_comp32.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/net/bpf_jit_comp32.c +0 -1
index 429a89c5468b..bc71329ac5ed 100644
@@ -1271,7 +1271,6 @@ static void emit_epilogue(u8 **pprog, u32
 stack_depth)
  static int emit_jmp_edx(u8 **pprog, u8 *ip)
  {
      u8 *prog = *pprog;
-    int cnt = 0;
 
  #ifdef CONFIG_RETPOLINE
Quoted 1 line
      EMIT1_off32(0xE9, (u8 *)__x86_indirect_thunk_edx - (ip + 5));

EMIT macroses are updating this cnt. Have you tested this patch by any chance?

Quoted 10 lines
arch/x86/net/bpf_jit_comp32.c +1 -1
@@ -1280,7 +1279,7 @@ static int emit_jmp_edx(u8 **pprog, u8 *ip)
  #endif
      *pprog = prog;
 
-    return cnt;
+    return 0;
  }
 
  /*