From: thinker.li@gmail.com
To: bpf@vger.kernel.org, ast@kernel.org, martin.lau@linux.dev,
song@kernel.org, kernel-team@meta.com, andrii@kernel.org
Cc: sinquersw@gmail.com, kuifeng@meta.com,
Kui-Feng Lee <thinker.li@gmail.com>,
kernel test robot <lkp@intel.com>
Subject: [PATCH bpf-next] selftests/bpf: Suppress warning message of an unused variable.
Date: Sat, 3 Feb 2024 22:12:04 -0800 [thread overview]
Message-ID: <20240204061204.1864529-1-thinker.li@gmail.com> (raw)
From: Kui-Feng Lee <thinker.li@gmail.com>
"r" is used to receive the return value of test_1 in bpf_testmod.c, but it
is not actually used. So, we remove "r" and change the return type to
"void".
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401300557.z5vzn8FM-lkp@intel.com/
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
---
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 6 ++----
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h | 2 +-
tools/testing/selftests/bpf/progs/struct_ops_module.c | 3 +--
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
index 4754c662b39f..a06daebc75c9 100644
--- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
+++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
@@ -554,9 +554,8 @@ static const struct bpf_verifier_ops bpf_testmod_verifier_ops = {
static int bpf_dummy_reg(void *kdata)
{
struct bpf_testmod_ops *ops = kdata;
- int r;
- r = ops->test_2(4, 3);
+ ops->test_2(4, 3);
return 0;
}
@@ -570,9 +569,8 @@ static int bpf_testmod_test_1(void)
return 0;
}
-static int bpf_testmod_test_2(int a, int b)
+static void bpf_testmod_test_2(int a, int b)
{
- return 0;
}
static struct bpf_testmod_ops __bpf_testmod_ops = {
diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h
index ca5435751c79..537beca42896 100644
--- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h
+++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h
@@ -30,7 +30,7 @@ struct bpf_iter_testmod_seq {
struct bpf_testmod_ops {
int (*test_1)(void);
- int (*test_2)(int a, int b);
+ void (*test_2)(int a, int b);
};
#endif /* _BPF_TESTMOD_H */
diff --git a/tools/testing/selftests/bpf/progs/struct_ops_module.c b/tools/testing/selftests/bpf/progs/struct_ops_module.c
index e44ac55195ca..b78746b3cef3 100644
--- a/tools/testing/selftests/bpf/progs/struct_ops_module.c
+++ b/tools/testing/selftests/bpf/progs/struct_ops_module.c
@@ -16,10 +16,9 @@ int BPF_PROG(test_1)
}
SEC("struct_ops/test_2")
-int BPF_PROG(test_2, int a, int b)
+void BPF_PROG(test_2, int a, int b)
{
test_2_result = a + b;
- return a + b;
}
SEC(".struct_ops.link")
--
2.34.1
next reply other threads:[~2024-02-04 6:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 6:12 thinker.li [this message]
2024-02-04 16:46 ` [PATCH bpf-next] selftests/bpf: Suppress warning message of an unused variable Yonghong Song
2024-02-05 19:00 ` patchwork-bot+netdevbpf
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=20240204061204.1864529-1-thinker.li@gmail.com \
--to=thinker.li@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=lkp@intel.com \
--cc=martin.lau@linux.dev \
--cc=sinquersw@gmail.com \
--cc=song@kernel.org \
/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