lib/overflow_kunit.c:295:14-19: Unneeded variable: "index". Return "0" on line 297

From: kernel test robot
Date: Sat Apr 06 2024 - 16:36:01 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f2f80ac809875855ac843f9e5e7480604b5cbff5
commit: 08d45ee84bb2650e237e150caca87cc4ded9b3e2 overflow: Introduce wrapping_assign_add() and wrapping_assign_sub()
date: 5 weeks ago
config: hexagon-randconfig-r053-20240406 (https://download.01.org/0day-ci/archive/20240407/202404070416.WaNXeve0-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a5955e355a3b27)

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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404070416.WaNXeve0-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> lib/overflow_kunit.c:295:14-19: Unneeded variable: "index". Return "0" on line 297

vim +295 lib/overflow_kunit.c

292
293 static int get_index(void)
294 {
> 295 volatile int index = 0;
296 bump_counter();
> 297 return index;
298 }
299

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki