Commit 20774655 authored by Geliang Tang's avatar Geliang Tang Committed by Martin KaFai Lau

selftests/bpf: Fix error checks of mptcp open_and_load

Return libbpf_get_error(), instead of -EIO, for the error from
mptcp_sock__open_and_load().

Load success means prog_fd and map_fd are always valid. So drop these
unneeded ASSERT_GE checks for them in mptcp run_test().
Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
Link: https://lore.kernel.org/r/db5fcb93293df9ab173edcbaf8252465b80da6f2.1692147782.git.geliang.tang@suse.comSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 97c9c652
......@@ -118,24 +118,14 @@ static int run_test(int cgroup_fd, int server_fd, bool is_mptcp)
sock_skel = mptcp_sock__open_and_load();
if (!ASSERT_OK_PTR(sock_skel, "skel_open_load"))
return -EIO;
return libbpf_get_error(sock_skel);
err = mptcp_sock__attach(sock_skel);
if (!ASSERT_OK(err, "skel_attach"))
goto out;
prog_fd = bpf_program__fd(sock_skel->progs._sockops);
if (!ASSERT_GE(prog_fd, 0, "bpf_program__fd")) {
err = -EIO;
goto out;
}
map_fd = bpf_map__fd(sock_skel->maps.socket_storage_map);
if (!ASSERT_GE(map_fd, 0, "bpf_map__fd")) {
err = -EIO;
goto out;
}
err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0);
if (!ASSERT_OK(err, "bpf_prog_attach"))
goto out;
......
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