From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4923239580746655723==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Sun, 13 Mar 2022 08:37:00 +0800 Message-ID: <20220313003700.GA50207@d5dd382eb358> In-Reply-To: <202203130825.G71b7lNN-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============4923239580746655723== 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: aad611a868d16cdc16a7d4a764cef955293e47e3 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 6 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) { --===============4923239580746655723==--