Re: [akpm-mm:mm-nonmm-unstable 38/65] fs/bcachefs/clock.c:150:18-21: Unneeded variable: "ret". Return "NULL" on line 164

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 03, 2024 at 12:46:08AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
> head:   54524b845fbe070c5401141bc4ff2ec3f01f1e72
> commit: cf66e6c3b24c5aaf365c54bb7dc8b9cb01f47f4d [38/65] bcachefs: remove heap-related macros and switch to generic min_heap
> config: x86_64-randconfig-102-20240602 (https://download.01.org/0day-ci/archive/20240603/202406030001.jwsq6DZp-lkp@xxxxxxxxx/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> 
> 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/202406030001.jwsq6DZp-lkp@xxxxxxxxx/
> 
> cocci warnings: (new ones prefixed by >>)
> >> fs/bcachefs/clock.c:150:18-21: Unneeded variable: "ret". Return "NULL" on line 164
>
Hi Andrew,

This error occurred because I forgot to store the minimum value into
'ret' before calling min_heap_pop(). Should I submit a new version of
the patch series or send a separate patch to fix this error?

Regards,
Kuan-Wei

> vim +150 fs/bcachefs/clock.c
> 
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  146  
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  147  static struct io_timer *get_expired_timer(struct io_clock *clock,
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  148  					  unsigned long now)
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  149  {
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16 @150  	struct io_timer *ret = NULL;
> cf66e6c3b24c5aa Kuan-Wei Chiu   2024-05-24  151  	const struct min_heap_callbacks callbacks = {
> cf66e6c3b24c5aa Kuan-Wei Chiu   2024-05-24  152  		.less = io_timer_cmp,
> cf66e6c3b24c5aa Kuan-Wei Chiu   2024-05-24  153  		.swp = io_timer_swp,
> cf66e6c3b24c5aa Kuan-Wei Chiu   2024-05-24  154  	};
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  155  
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  156  	spin_lock(&clock->timer_lock);
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  157  
> cf66e6c3b24c5aa Kuan-Wei Chiu   2024-05-24  158  	if (clock->timers.nr &&
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  159  	    time_after_eq(now, clock->timers.data[0]->expire))
> cf66e6c3b24c5aa Kuan-Wei Chiu   2024-05-24  160  		min_heap_pop(&clock->timers, &callbacks, NULL);
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  161  
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  162  	spin_unlock(&clock->timer_lock);
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  163  
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16 @164  	return ret;
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  165  }
> 1c6fdbd8f2465dd Kent Overstreet 2017-03-16  166  
> 
> :::::: The code at line 150 was first introduced by commit
> :::::: 1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a bcachefs: Initial commit
> 
> :::::: TO: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> :::::: CC: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux