From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7298671403914574162==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Thu, 10 Feb 2022 09:20:50 +0800 Message-ID: <20220210012050.GA54399@309e11f24dd2> In-Reply-To: <202202100903.nC4ASJ41-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7298671403914574162== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Jaroslav Kysela CC: Takashi Iwai CC: Ranjani Sridharan CC: "Pierre-Louis Bossart" 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: f4bc5bbb5fef3cf421ba3485d6d383c27ec473ed commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 7 hours ago :::::: commit date: 9 months ago Please take the patch only if it's a positive warning. Thanks! 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) { --===============7298671403914574162==--