Skip to contentSkip to conversation

tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c:557:13: warning: variable 'r' set but not used

PATCH kernel test robot 3 participants 3 messages Jan 29, 2024 – Feb 5, 2024

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   596764183be8ebb13352b281a442a1f1151c9b06
commit: 0253e0590e2dc46996534371d56b5297099aed4e [1465/2825] selftests/bpf: test case for register_bpf_struct_ops().
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c: In function 'bpf_dummy_reg':

>> tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c:557:13: warning: variable 'r' set but not used [-Wunused-but-set-variable]
     557 |         int r;
         |             ^

vim +/r +557 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c

553
554 static int bpf_dummy_reg(void *kdata)
555 {
556 struct bpf_testmod_ops *ops = kdata;

 > 557		int r;

558
559 r = ops->test_2(4, 3);
560
561 return 0;
562 }
563

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 19 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   596764183be8ebb13352b281a442a1f1151c9b06
commit: 0253e0590e2dc46996534371d56b5297099aed4e [1465/2825] selftests/bpf: test case for register_bpf_struct_ops().
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c: In function 'bpf_dummy_reg':

Quoted 1 line
Quoted 1 line

tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c:557:13: warning: variable 'r' set but not used [-Wunused-but-set-variable]

      557 |         int r;
          |             ^
Quoted 7 lines

vim +/r +557 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c

    553	
    554	static int bpf_dummy_reg(void *kdata)
    555	{
    556		struct bpf_testmod_ops *ops = kdata;
Quoted 1 line

557 int r;

Kui-Feng, Please take a look. May be change the ".test_2" return type to "void" since it is not used.

Quoted 7 lines
    558	
    559		r = ops->test_2(4, 3);
    560	
    561		return 0;
    562	}
    563	
#2 lore raw
Quoted 18 lines · Martin KaFai Lau
Quoted 7 lines

vim +/r +557 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c

    553
    554    static int bpf_dummy_reg(void *kdata) 555    {
    556        struct bpf_testmod_ops *ops = kdata; > 557        int r;

Kui-Feng, Please take a look. May be change the ".test_2" return type to "void" since it is not used.

Quoted 7 lines

    558
    559        r = ops->test_2(4, 3);
    560
    561        return 0;
    562    }
    563

The fix has been landed. FYI!
https://lore.kernel.org/all/[email protected]/