[linux-next:master 1831/9043] fs/iomap/direct-io.c:939:36-37: WARNING opportunity for min()

kernel test robot <[email protected]> Sun, 26 Jul 2026 02:57:21 +0800
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: Fengnan Chang <[email protected]>
CC: Christian Brauner <[email protected]>
CC: Christoph Hellwig <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   9eebf259d5352b87080d67758f483583d9e763d7
commit: c45650e4f8ba25d02e860094a77bf85ec3a35f13 [1831/9043] iomap: add simple dio path for small direct I/O
:::::: branch date: 2 days ago
:::::: commit date: 3 weeks ago
config: microblaze-randconfig-r053-20260725 (https://download.01.org/0day-ci/archive/20260726/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 8.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]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> fs/iomap/direct-io.c:939:36-37: WARNING opportunity for min()

vim +939 fs/iomap/direct-io.c

c45650e4f8ba25 Fengnan Chang 2026-07-01  913  
c45650e4f8ba25 Fengnan Chang 2026-07-01  914  static ssize_t iomap_dio_simple_complete(struct iomap_dio_simple *sr)
c45650e4f8ba25 Fengnan Chang 2026-07-01  915  {
c45650e4f8ba25 Fengnan Chang 2026-07-01  916  	struct bio *bio = &sr->bio;
c45650e4f8ba25 Fengnan Chang 2026-07-01  917  	struct kiocb *iocb = sr->iocb;
c45650e4f8ba25 Fengnan Chang 2026-07-01  918  	struct inode *inode = file_inode(iocb->ki_filp);
c45650e4f8ba25 Fengnan Chang 2026-07-01  919  	ssize_t ret;
c45650e4f8ba25 Fengnan Chang 2026-07-01  920  
c45650e4f8ba25 Fengnan Chang 2026-07-01  921  	if (unlikely(bio->bi_status)) {
c45650e4f8ba25 Fengnan Chang 2026-07-01  922  		ret = blk_status_to_errno(bio->bi_status);
c45650e4f8ba25 Fengnan Chang 2026-07-01  923  		if (should_report_dio_fserror(ret))
c45650e4f8ba25 Fengnan Chang 2026-07-01  924  			fserror_report_io(inode, FSERR_DIRECTIO_READ,
c45650e4f8ba25 Fengnan Chang 2026-07-01  925  					  iocb->ki_pos, sr->size, ret,
c45650e4f8ba25 Fengnan Chang 2026-07-01  926  					  GFP_NOFS);
c45650e4f8ba25 Fengnan Chang 2026-07-01  927  	} else {
c45650e4f8ba25 Fengnan Chang 2026-07-01  928  		ret = sr->size;
c45650e4f8ba25 Fengnan Chang 2026-07-01  929  		iocb->ki_pos += ret;
c45650e4f8ba25 Fengnan Chang 2026-07-01  930  	}
c45650e4f8ba25 Fengnan Chang 2026-07-01  931  
c45650e4f8ba25 Fengnan Chang 2026-07-01  932  	if (sr->dio_flags & IOMAP_DIO_USER_BACKED) {
c45650e4f8ba25 Fengnan Chang 2026-07-01  933  		bio_check_pages_dirty(bio);
c45650e4f8ba25 Fengnan Chang 2026-07-01  934  	} else {
c45650e4f8ba25 Fengnan Chang 2026-07-01  935  		bio_release_pages(bio, false);
c45650e4f8ba25 Fengnan Chang 2026-07-01  936  		bio_put(bio);
c45650e4f8ba25 Fengnan Chang 2026-07-01  937  	}
c45650e4f8ba25 Fengnan Chang 2026-07-01  938  	inode_dio_end(inode);
c45650e4f8ba25 Fengnan Chang 2026-07-01 @939  	trace_iomap_dio_complete(iocb, ret < 0 ? ret : 0, ret);
c45650e4f8ba25 Fengnan Chang 2026-07-01  940  	return ret;
c45650e4f8ba25 Fengnan Chang 2026-07-01  941  }
c45650e4f8ba25 Fengnan Chang 2026-07-01  942  

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