summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Bauer <lmb@cloudflare.com>2020-08-24 09:45:23 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-08-24 14:51:46 -0700
commit8c3b3d971f2e4d72d8768457c40b513ca5d1f906 (patch)
treec1de23513b83f98f87a43b34ca54a8341f465f25
parentf872e4bc47f100ccbbe9469cd12e5ac78e4b6eda (diff)
selftests: bpf: Fix sockmap update nits
Address review by Yonghong, to bring the new tests in line with the usual code style. Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20200824084523.13104-1-lmb@cloudflare.com
-rw-r--r--tools/testing/selftests/bpf/prog_tests/sockmap_basic.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
index 65ce7c289534..0b79d78b98db 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
@@ -118,10 +118,8 @@ static void test_sockmap_update(enum bpf_map_type map_type)
return;
skel = test_sockmap_update__open_and_load();
- if (CHECK(!skel, "open_and_load", "cannot load skeleton\n")) {
- close(sk);
- return;
- }
+ if (CHECK(!skel, "open_and_load", "cannot load skeleton\n"))
+ goto close_sk;
prog = bpf_program__fd(skel->progs.copy_sock_map);
src = bpf_map__fd(skel->maps.src);
@@ -158,8 +156,9 @@ static void test_sockmap_update(enum bpf_map_type map_type)
dst_cookie, src_cookie);
out:
- close(sk);
test_sockmap_update__destroy(skel);
+close_sk:
+ close(sk);
}
static void test_sockmap_invalid_update(void)
@@ -168,8 +167,7 @@ static void test_sockmap_invalid_update(void)
int duration = 0;
skel = test_sockmap_invalid_update__open_and_load();
- CHECK(skel, "open_and_load", "verifier accepted map_update\n");
- if (skel)
+ if (CHECK(skel, "open_and_load", "verifier accepted map_update\n"))
test_sockmap_invalid_update__destroy(skel);
}