Skip to content

Commit bd2d4e6

Browse files
Jiapeng Chonganakryiko
Jiapeng Chong
authored andcommitted
selftests/bpf: Simplify the calculation of variables
Fix the following coccicheck warnings: ./tools/testing/selftests/bpf/xdpxceiver.c:954:28-30: WARNING !A || A && B is equivalent to !A || B. ./tools/testing/selftests/bpf/xdpxceiver.c:932:28-30: WARNING !A || A && B is equivalent to !A || B. ./tools/testing/selftests/bpf/xdpxceiver.c:909:28-30: WARNING !A || A && B is equivalent to !A || B. Reported-by: Abaci Robot <[email protected]> Signed-off-by: Jiapeng Chong <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/1612860398-102839-1-git-send-email-jiapeng.chong@linux.alibaba.com
1 parent 45df305 commit bd2d4e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/xdpxceiver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static void *worker_testapp_validate(void *arg)
897897
ksft_print_msg("Destroying socket\n");
898898
}
899899

900-
if (!opt_bidi || (opt_bidi && bidi_pass)) {
900+
if (!opt_bidi || bidi_pass) {
901901
xsk_socket__delete(ifobject->xsk->xsk);
902902
(void)xsk_umem__delete(ifobject->umem->umem);
903903
}
@@ -922,7 +922,7 @@ static void testapp_validate(void)
922922
pthread_mutex_lock(&sync_mutex);
923923

924924
/*Spawn RX thread */
925-
if (!opt_bidi || (opt_bidi && !bidi_pass)) {
925+
if (!opt_bidi || !bidi_pass) {
926926
if (pthread_create(&t0, &attr, worker_testapp_validate, ifdict[1]))
927927
exit_with_error(errno);
928928
} else if (opt_bidi && bidi_pass) {
@@ -942,7 +942,7 @@ static void testapp_validate(void)
942942
pthread_mutex_unlock(&sync_mutex);
943943

944944
/*Spawn TX thread */
945-
if (!opt_bidi || (opt_bidi && !bidi_pass)) {
945+
if (!opt_bidi || !bidi_pass) {
946946
if (pthread_create(&t1, &attr, worker_testapp_validate, ifdict[0]))
947947
exit_with_error(errno);
948948
} else if (opt_bidi && bidi_pass) {

0 commit comments

Comments
 (0)