From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5898300128392919574==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Sat, 02 Apr 2022 13:28:46 +0800 Message-ID: In-Reply-To: <202204021326.FYR2dMdU-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============5898300128392919574== 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: Jaroslav Kysela CC: Takashi Iwai CC: Ranjani Sridharan CC: alsa-devel(a)alsa-project.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot sound/pci/hda/hda_codec.c:337:19-20: 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: 88e6c0207623874922712e162e25d9dafd39661e commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 3 hours ago :::::: commit date: 11 months ago Please take the patch only if it's a positive warning. Thanks! sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -334,7 +334,7 @@ int snd_hda_get_devices(struct hda_codec return 0; = dev_len =3D parm + 1; - dev_len =3D dev_len < max_devices ? dev_len : max_devices; + dev_len =3D min(dev_len, max_devices); = devices =3D 0; while (devices < dev_len) { --===============5898300128392919574==--