From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6711266504983191799==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Mon, 28 Mar 2022 20:03:07 +0800 Message-ID: <20220328120307.GA21233@66869a144509> In-Reply-To: <202203282048.KbPetXnh-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============6711266504983191799== 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: alsa-devel(a)alsa-project.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot sound/core/seq/seq_ports.c:142:12-14: WARNING opportunity for max() 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: ae085d7f9365de7da27ab5c0d16b12d51ea7fca9 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! sound/core/seq/seq_ports.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c @@ -139,7 +139,7 @@ struct snd_seq_client_port *snd_seq_crea port_subs_info_init(&new_port->c_dest); snd_use_lock_use(&new_port->use_lock); = - num =3D port >=3D 0 ? port : 0; + num =3D max(port, 0); mutex_lock(&client->ports_mutex); write_lock_irq(&client->ports_lock); list_for_each_entry(p, &client->ports_list_head, list) { --===============6711266504983191799==--