diff options
author | Zhu Jun <zhujun2@cmss.chinamobile.com> | 2024-10-10 08:57:37 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-10-11 05:15:02 +0300 |
commit | ba4fb3b3f7d891ba2fb82fe344d5068f87d7481c (patch) | |
tree | 58a6bbd2965961c2fe0c4f3e2d9e04615e65c1b3 | |
parent | f3ef53174b23246fe9bc2bbc2542f3a3856fa1e2 (diff) | |
download | linux-ba4fb3b3f7d891ba2fb82fe344d5068f87d7481c.tar.xz |
selftests/bpf: Removed redundant fd after close in bpf_prog_load_log_buf
Removed unnecessary `fd = -1` assignments after closing file descriptors.
because it will be assigned by the function bpf_prog_load().This improves
code readability and removes redundant operations.
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241010055737.4292-1-zhujun2@cmss.chinamobile.com
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/log_buf.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/log_buf.c b/tools/testing/selftests/bpf/prog_tests/log_buf.c index 27676a04d0b6..169ce689b97c 100644 --- a/tools/testing/selftests/bpf/prog_tests/log_buf.c +++ b/tools/testing/selftests/bpf/prog_tests/log_buf.c @@ -169,7 +169,6 @@ static void bpf_prog_load_log_buf(void) ASSERT_GE(fd, 0, "good_fd1"); if (fd >= 0) close(fd); - fd = -1; /* log_level == 2 should always fill log_buf, even for good prog */ log_buf[0] = '\0'; @@ -180,7 +179,6 @@ static void bpf_prog_load_log_buf(void) ASSERT_GE(fd, 0, "good_fd2"); if (fd >= 0) close(fd); - fd = -1; /* log_level == 0 should fill log_buf for bad prog */ log_buf[0] = '\0'; @@ -191,7 +189,6 @@ static void bpf_prog_load_log_buf(void) ASSERT_LT(fd, 0, "bad_fd"); if (fd >= 0) close(fd); - fd = -1; free(log_buf); } |