]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selftests/bpf: Suppress warning message of an unused variable.
authorKui-Feng Lee <thinker.li@gmail.com>
Sun, 4 Feb 2024 06:12:04 +0000 (22:12 -0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 5 Feb 2024 18:52:38 +0000 (10:52 -0800)
"r" is used to receive the return value of test_2 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>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20240204061204.1864529-1-thinker.li@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h
tools/testing/selftests/bpf/progs/struct_ops_module.c

index 4754c662b39ff8de9b7a8efdbfa255a75c0851c8..a06daebc75c9bb5035fe7e585b6773a788a86d58 100644 (file)
@@ -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 = {
index ca5435751c79460381892924b13f8befb34b58a7..537beca42896a2cafdc3ccd19aa70cb6439b6468 100644 (file)
@@ -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 */
index e44ac55195ca9468b2a06d8ee486374233e705bb..b78746b3cef35c783bcfaea16bb3c04e6aae7c96 100644 (file)
@@ -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")