From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8860447356169186748==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Thu, 17 Mar 2022 00:51:32 +0800 Message-ID: <20220316165132.GA116341@56abe658c848> In-Reply-To: <202203170021.merEX2XN-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8860447356169186748== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Alan Stern CC: "Greg Kroah-Hartman" CC: linux-usb(a)vger.kernel.org CC: usb-storage(a)lists.one-eyed-alien.net CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/usb/storage/realtek_cr.c:264:20-21: 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 CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 56e337f2cf1326323844927a04e9dbce9a244835 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 24 hours ago :::::: commit date: 11 months ago Please take the patch only if it's a positive warning. Thanks! drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c @@ -261,7 +261,7 @@ static int rts51x_bulk_transport(struct * was really transferred and what the device tells us */ if (residue) - residue =3D residue < buf_len ? residue : buf_len; + residue =3D min(residue, buf_len); = if (act_len) *act_len =3D buf_len - residue; --===============8860447356169186748==--