diff mbox series

bpf: Simplify the calculation of variables

Message ID 1614756035-111280-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series bpf: Simplify the calculation of variables | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Jiapeng Chong March 3, 2021, 7:20 a.m. UTC
Fix the following coccicheck warnings:

./tools/bpf/bpf_dbg.c:1201:55-57: WARNING !A || A && B is equivalent to
!A || B.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/bpf/bpf_dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yonghong Song March 3, 2021, 7:31 a.m. UTC | #1
On 3/2/21 11:20 PM, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./tools/bpf/bpf_dbg.c:1201:55-57: WARNING !A || A && B is equivalent to
> !A || B.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Acked-by: Yonghong Song <yhs@fb.com>
diff mbox series

Patch

diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_dbg.c
index a07dfc4..00e560a 100644
--- a/tools/bpf/bpf_dbg.c
+++ b/tools/bpf/bpf_dbg.c
@@ -1198,7 +1198,7 @@  static int cmd_run(char *num)
 		else
 			return CMD_OK;
 		bpf_reset();
-	} while (pcap_next_pkt() && (!has_limit || (has_limit && ++i < pkts)));
+	} while (pcap_next_pkt() && (!has_limit || (++i < pkts)));
 
 	rl_printf("bpf passes:%u fails:%u\n", pass, fail);