Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix an unused-but-set-variable compiler warning

When using clang to build selftests with LLVM=1 in make commandline,
I hit the following compiler warning:
xdpxceiver.c:747:6: warning: variable 'total' set but not used [-Wunused-but-set-variable]
u32 total = 0;
^

This patch fixed the issue by removing that declaration and its
assocatied unused operation.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211112204833.3579457-1-yhs@fb.com

authored by

Yonghong Song and committed by
Alexei Starovoitov
21c6ec3d 7cc595a6

-2
-2
tools/testing/selftests/bpf/xdpxceiver.c
··· 744 744 struct pkt *pkt = pkt_stream_get_next_rx_pkt(pkt_stream); 745 745 struct xsk_umem_info *umem = xsk->umem; 746 746 u32 idx_rx = 0, idx_fq = 0, rcvd, i; 747 - u32 total = 0; 748 747 int ret; 749 748 750 749 while (pkt) { ··· 798 799 799 800 pthread_mutex_lock(&pacing_mutex); 800 801 pkts_in_flight -= rcvd; 801 - total += rcvd; 802 802 if (pkts_in_flight < umem->num_frames) 803 803 pthread_cond_signal(&pacing_cond); 804 804 pthread_mutex_unlock(&pacing_mutex);