From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0714538501439750348==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Thu, 31 Mar 2022 16:30:31 +0800 Message-ID: In-Reply-To: <202203311613.ig9rkBJl-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============0714538501439750348== 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: Dmitry Torokhov CC: linux-input(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/input/joystick/adi.c:395:13-14: 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: 787af64d05cd528aac9ad16752d11bb1c6061bb9 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 10 hours ago :::::: commit date: 11 months ago Please take the patch only if it's a positive warning. Thanks! drivers/input/joystick/adi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -392,7 +392,7 @@ static int adi_init_input(struct adi *ad if (!input_dev) return -ENOMEM; = - t =3D adi->id < ADI_ID_MAX ? adi->id : ADI_ID_MAX; + t =3D min(adi->id, ADI_ID_MAX); = snprintf(buf, ADI_MAX_PHYS_LENGTH, adi_names[t], adi->id); snprintf(adi->name, ADI_MAX_NAME_LENGTH, "Logitech %s [%s]", buf, adi->cn= ame); --===============0714538501439750348==--