Commit 8c3b3d97 authored by Lorenz Bauer's avatar Lorenz Bauer Committed by Alexei Starovoitov

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: default avatarLorenz Bauer <lmb@cloudflare.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarYonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20200824084523.13104-1-lmb@cloudflare.com
parent f872e4bc
...@@ -118,10 +118,8 @@ static void test_sockmap_update(enum bpf_map_type map_type) ...@@ -118,10 +118,8 @@ static void test_sockmap_update(enum bpf_map_type map_type)
return; return;
skel = test_sockmap_update__open_and_load(); skel = test_sockmap_update__open_and_load();
if (CHECK(!skel, "open_and_load", "cannot load skeleton\n")) { if (CHECK(!skel, "open_and_load", "cannot load skeleton\n"))
close(sk); goto close_sk;
return;
}
prog = bpf_program__fd(skel->progs.copy_sock_map); prog = bpf_program__fd(skel->progs.copy_sock_map);
src = bpf_map__fd(skel->maps.src); src = bpf_map__fd(skel->maps.src);
...@@ -158,8 +156,9 @@ static void test_sockmap_update(enum bpf_map_type map_type) ...@@ -158,8 +156,9 @@ static void test_sockmap_update(enum bpf_map_type map_type)
dst_cookie, src_cookie); dst_cookie, src_cookie);
out: out:
close(sk);
test_sockmap_update__destroy(skel); test_sockmap_update__destroy(skel);
close_sk:
close(sk);
} }
static void test_sockmap_invalid_update(void) static void test_sockmap_invalid_update(void)
...@@ -168,8 +167,7 @@ static void test_sockmap_invalid_update(void) ...@@ -168,8 +167,7 @@ static void test_sockmap_invalid_update(void)
int duration = 0; int duration = 0;
skel = test_sockmap_invalid_update__open_and_load(); skel = test_sockmap_invalid_update__open_and_load();
CHECK(skel, "open_and_load", "verifier accepted map_update\n"); if (CHECK(skel, "open_and_load", "verifier accepted map_update\n"))
if (skel)
test_sockmap_invalid_update__destroy(skel); test_sockmap_invalid_update__destroy(skel);
} }
......
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