All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [linux-next:master 5568/5998] block/genhd.c:150:23-24: WARNING opportunity for max()
Date: Fri, 27 Jun 2025 23:10:33 +0800	[thread overview]
Message-ID: <202506272336.CvAqaAxB-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Yu Kuai <yukuai3@huawei.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Christoph Hellwig <hch@lst.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2aeda9592360c200085898a258c4754bfe879921
commit: c007062188d8e402c294117db53a24b2bed2b83f [5568/5998] block: fix false warning in bdev_count_inflight_rw()
:::::: branch date: 6 hours ago
:::::: commit date: 26 hours ago
config: x86_64-randconfig-101-20250627 (https://download.01.org/0day-ci/archive/20250627/202506272336.CvAqaAxB-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.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 <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202506272336.CvAqaAxB-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> block/genhd.c:150:23-24: WARNING opportunity for max()
   block/genhd.c:151:25-26: WARNING opportunity for max()

vim +150 block/genhd.c

ea18e0f0a63af9 Konstantin Khlebnikov 2020-03-25  127  
f2987c5816bda0 Yu Kuai               2025-05-06  128  static void bdev_count_inflight_rw(struct block_device *part,
6b6c3a97abdebf Yu Kuai               2025-05-06  129  		unsigned int inflight[2], bool mq_driver)
bf0ddaba65ddbb Omar Sandoval         2018-04-26  130  {
c007062188d8e4 Yu Kuai               2025-06-26  131  	int write = 0;
c007062188d8e4 Yu Kuai               2025-06-26  132  	int read = 0;
1226b8dd0e9133 Mikulas Patocka       2018-12-06  133  	int cpu;
1226b8dd0e9133 Mikulas Patocka       2018-12-06  134  
6b6c3a97abdebf Yu Kuai               2025-05-06  135  	if (mq_driver) {
6b6c3a97abdebf Yu Kuai               2025-05-06  136  		blk_mq_in_driver_rw(part, inflight);
c007062188d8e4 Yu Kuai               2025-06-26  137  		return;
6b6c3a97abdebf Yu Kuai               2025-05-06  138  	}
c007062188d8e4 Yu Kuai               2025-06-26  139  
c007062188d8e4 Yu Kuai               2025-06-26  140  	for_each_possible_cpu(cpu) {
c007062188d8e4 Yu Kuai               2025-06-26  141  		read += part_stat_local_read_cpu(part, in_flight[READ], cpu);
c007062188d8e4 Yu Kuai               2025-06-26  142  		write += part_stat_local_read_cpu(part, in_flight[WRITE], cpu);
1226b8dd0e9133 Mikulas Patocka       2018-12-06  143  	}
6b6c3a97abdebf Yu Kuai               2025-05-06  144  
c007062188d8e4 Yu Kuai               2025-06-26  145  	/*
c007062188d8e4 Yu Kuai               2025-06-26  146  	 * While iterating all CPUs, some IOs may be issued from a CPU already
c007062188d8e4 Yu Kuai               2025-06-26  147  	 * traversed and complete on a CPU that has not yet been traversed,
c007062188d8e4 Yu Kuai               2025-06-26  148  	 * causing the inflight number to be negative.
c007062188d8e4 Yu Kuai               2025-06-26  149  	 */
c007062188d8e4 Yu Kuai               2025-06-26 @150  	inflight[READ] = read > 0 ? read : 0;
c007062188d8e4 Yu Kuai               2025-06-26  151  	inflight[WRITE] = write > 0 ? write : 0;
bf0ddaba65ddbb Omar Sandoval         2018-04-26  152  }
bf0ddaba65ddbb Omar Sandoval         2018-04-26  153  

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

                 reply	other threads:[~2025-06-27 15:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202506272336.CvAqaAxB-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.