From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7380154937470387864==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Sun, 02 May 2021 09:01:50 +0800 Message-ID: <20210502010150.GA17257@43098db6d9e0> In-Reply-To: <202105020845.qMwklVPu-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7380154937470387864== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org TO: Denis Efremov CC: Julia Lawall CC: Sathya Prakash CC: Sreekanth Reddy CC: Suganath Prabu Subramani CC: MPT-FusionLinux.pdl(a)broadcom.com CC: linux-scsi(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/message/fusion/mptctl.c:1618:29-30: WARNING opportunity for min() Check for opencoded min(), max() implementations. Generated patches sometimes require adding a cast to fix compile warning. Warnings/patches scope intentionally limited to a function body. Generated by: scripts/coccinelle/misc/minmax.cocci Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script") CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git f= or-5.12 head: afa104b04309a6e882f6797216e74489c0d5534f commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/6] coccinelle: misc: ad= d minmax script :::::: branch date: 4 days ago :::::: commit date: 6 weeks ago Please take the patch only if it's a positive warning. Thanks! mptctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -1615,7 +1615,7 @@ mptctl_eventreport (MPT_ADAPTER *ioc, un maxEvents =3D numBytes/sizeof(MPT_IOCTL_EVENTS); = = - max =3D MPTCTL_EVENT_LOG_SIZE < maxEvents ? MPTCTL_EVENT_LOG_SIZE : maxEv= ents; + max =3D min(MPTCTL_EVENT_LOG_SIZE, maxEvents); = /* If fewer than 1 event is requested, there must have * been some type of error. --===============7380154937470387864==--