[mcgrof:blk-iobuf-pool-v5 1/9] block/blk-iobuf.c:243:14-15: WARNING opportunity for max()

kernel test robot <[email protected]> Fri, 31 Jul 2026 06:37:06 +0800
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: Luis Chamberlain <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git blk-iobuf-pool-v5
head:   de80bacbf04a137715357b6a2948d9f29a18d990
commit: 418f01253da9a31b8c48acfca9942a812392f1d1 [1/9] block: add a bounded refcounted iobuf folio pool
:::::: branch date: 9 days ago
:::::: commit date: 9 days ago
config: x86_64-randconfig-101-20260731 (https://download.01.org/0day-ci/archive/20260731/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.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]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> block/blk-iobuf.c:243:14-15: WARNING opportunity for max()

vim +243 block/blk-iobuf.c

418f01253da9a31 Luis Chamberlain 2026-07-21  238  
418f01253da9a31 Luis Chamberlain 2026-07-21  239  unsigned int blk_iobuf_pool_available(const struct blk_iobuf_pool *pool)
418f01253da9a31 Luis Chamberlain 2026-07-21  240  {
418f01253da9a31 Luis Chamberlain 2026-07-21  241  	int avail = (int)pool->capacity - atomic_read(&pool->in_use);
418f01253da9a31 Luis Chamberlain 2026-07-21  242  
418f01253da9a31 Luis Chamberlain 2026-07-21 @243  	return avail > 0 ? avail : 0;
418f01253da9a31 Luis Chamberlain 2026-07-21  244  }
418f01253da9a31 Luis Chamberlain 2026-07-21  245  EXPORT_SYMBOL_GPL(blk_iobuf_pool_available);
418f01253da9a31 Luis Chamberlain 2026-07-21  246  

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