Commit bd2d4e6c authored by Jiapeng Chong's avatar Jiapeng Chong Committed by Andrii Nakryiko

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: default avatarAbaci Robot <abaci@linux.alibaba.com>
Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1612860398-102839-1-git-send-email-jiapeng.chong@linux.alibaba.com
parent 45df3052
...@@ -897,7 +897,7 @@ static void *worker_testapp_validate(void *arg) ...@@ -897,7 +897,7 @@ static void *worker_testapp_validate(void *arg)
ksft_print_msg("Destroying socket\n"); ksft_print_msg("Destroying socket\n");
} }
if (!opt_bidi || (opt_bidi && bidi_pass)) { if (!opt_bidi || bidi_pass) {
xsk_socket__delete(ifobject->xsk->xsk); xsk_socket__delete(ifobject->xsk->xsk);
(void)xsk_umem__delete(ifobject->umem->umem); (void)xsk_umem__delete(ifobject->umem->umem);
} }
...@@ -922,7 +922,7 @@ static void testapp_validate(void) ...@@ -922,7 +922,7 @@ static void testapp_validate(void)
pthread_mutex_lock(&sync_mutex); pthread_mutex_lock(&sync_mutex);
/*Spawn RX thread */ /*Spawn RX thread */
if (!opt_bidi || (opt_bidi && !bidi_pass)) { if (!opt_bidi || !bidi_pass) {
if (pthread_create(&t0, &attr, worker_testapp_validate, ifdict[1])) if (pthread_create(&t0, &attr, worker_testapp_validate, ifdict[1]))
exit_with_error(errno); exit_with_error(errno);
} else if (opt_bidi && bidi_pass) { } else if (opt_bidi && bidi_pass) {
...@@ -942,7 +942,7 @@ static void testapp_validate(void) ...@@ -942,7 +942,7 @@ static void testapp_validate(void)
pthread_mutex_unlock(&sync_mutex); pthread_mutex_unlock(&sync_mutex);
/*Spawn TX thread */ /*Spawn TX thread */
if (!opt_bidi || (opt_bidi && !bidi_pass)) { if (!opt_bidi || !bidi_pass) {
if (pthread_create(&t1, &attr, worker_testapp_validate, ifdict[0])) if (pthread_create(&t1, &attr, worker_testapp_validate, ifdict[0]))
exit_with_error(errno); exit_with_error(errno);
} else if (opt_bidi && bidi_pass) { } else if (opt_bidi && bidi_pass) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment