[jimc:dd-ratelimit-2 61/76] lib/dynamic_debug_ratelimit.c:151:4-9: WARNING: NULL check before some freeing functions is not needed.

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/jimc/linux.git dd-ratelimit-2
head:   31212444bcca4d1547711ec572b5a398d74640ca
commit: 3ffeebe328d9f1bc581ba7163321a9519ec821d3 [61/76] lib/dynamic_debug: Implement dynamic solo and shared rate-limiting
config: nios2-randconfig-r051-20260819 (https://download.01.org/0day-ci/archive/20260819/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 11.5.0

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]/

cocci warnings: (new ones prefixed by >>)
>> lib/dynamic_debug_ratelimit.c:151:4-9: WARNING: NULL check before some freeing functions is not needed.

vim +151 lib/dynamic_debug_ratelimit.c

   140	
   141	void ddebug_ratelimit_free_info(const struct _ddebug_info *di)
   142	{
   143		int i;
   144		struct _ddebug *dp;
   145	
   146		for (i = 0; i < di->descs.len; i++) {
   147			dp = &di->descs.start[i];
   148			if (dp->flags & _DPRINTK_FLAGS_RATELIMIT_SOLO) {
   149				struct ddebug_ratelimit_solo *wrapper = mtree_erase(&dd_ratelimits_solo, (unsigned long)dp);
   150				if (wrapper)
 > 151					kfree(wrapper); /* Unloading module context is safe for direct kfree */

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.