From: Yonghong Song <yonghong.song@linux.dev>
To: Zhu Jun <zhujun2@cmss.chinamobile.com>, shuah@kernel.org
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, martin.lau@linux.dev,
ast@kernel.org
Subject: Re: [PATCH] selftests/bpf: Remove unused variable
Date: Mon, 18 Nov 2024 08:40:44 -0800 [thread overview]
Message-ID: <37c96a19-6e90-42f0-be42-b00d9b78adeb@linux.dev> (raw)
In-Reply-To: <20241118093440.2818-1-zhujun2@cmss.chinamobile.com>
On 11/18/24 1:34 AM, Zhu Jun wrote:
> the variable is never referenced in the code, just remove them.
>
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
> tools/testing/selftests/bpf/prog_tests/log_buf.c | 2 --
> 1 file changed, 2 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..5d1678b15d8b 100644
> --- a/tools/testing/selftests/bpf/prog_tests/log_buf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/log_buf.c
> @@ -191,7 +191,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);
> }
This patch failed to apply to latest bpf-next.
$ git apply ~/p1.txt
error: patch failed: tools/testing/selftests/bpf/prog_tests/log_buf.c:191
error: tools/testing/selftests/bpf/prog_tests/log_buf.c: patch does not apply
The reason is the above 'fd = -1' already gone:
188 ASSERT_OK_PTR(strstr(log_buf, "R0 !read_ok"), "bad_log_0");
189 ASSERT_LT(fd, 0, "bad_fd");
190 if (fd >= 0)
191 close(fd);
192
193 free(log_buf);
194 }
> @@ -259,7 +258,6 @@ static void bpf_btf_load_log_buf(void)
> ASSERT_LT(fd, 0, "bad_fd");
> if (fd >= 0)
> close(fd);
> - fd = -1;
>
> cleanup:
> free(log_buf);
There are more redundant 'fd = -1' in function bpf_btf_load_log_buf(),
you may want to remove them as well.
prev parent reply other threads:[~2024-11-18 16:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 9:34 [PATCH] selftests/bpf: Remove unused variable Zhu Jun
2024-11-18 16:40 ` Yonghong Song [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37c96a19-6e90-42f0-be42-b00d9b78adeb@linux.dev \
--to=yonghong.song@linux.dev \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=shuah@kernel.org \
--cc=zhujun2@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).