* [PATCH] selftests/bpf: Removed redundant fd after close in bpf_prog_load_log_buf
@ 2024-10-10 5:57 Zhu Jun
2024-10-11 2:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Zhu Jun @ 2024-10-10 5:57 UTC (permalink / raw)
To: andrii
Cc: eddyz87, shuah, bpf, linux-kselftest, linux-kernel, zhujun2,
mykolal, martin.lau, song, yonghong.song, john.fastabend, kpsingh,
sdf, haoluo, jolsa
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>
---
tools/testing/selftests/bpf/prog_tests/log_buf.c | 3 ---
1 file changed, 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);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/bpf: Removed redundant fd after close in bpf_prog_load_log_buf
2024-10-10 5:57 [PATCH] selftests/bpf: Removed redundant fd after close in bpf_prog_load_log_buf Zhu Jun
@ 2024-10-11 2:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-11 2:20 UTC (permalink / raw)
To: Zhu Jun
Cc: andrii, eddyz87, shuah, bpf, linux-kselftest, linux-kernel,
mykolal, martin.lau, song, yonghong.song, john.fastabend, kpsingh,
sdf, haoluo, jolsa
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Wed, 9 Oct 2024 22:57:37 -0700 you wrote:
> 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>
> ---
> tools/testing/selftests/bpf/prog_tests/log_buf.c | 3 ---
> 1 file changed, 3 deletions(-)
Here is the summary with links:
- selftests/bpf: Removed redundant fd after close in bpf_prog_load_log_buf
https://git.kernel.org/bpf/bpf-next/c/ba4fb3b3f7d8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-11 2:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 5:57 [PATCH] selftests/bpf: Removed redundant fd after close in bpf_prog_load_log_buf Zhu Jun
2024-10-11 2:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox