From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7943103933038680539==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Sun, 13 Feb 2022 14:26:12 +0800 Message-ID: <20220213062612.GA75277@4254297cc778> In-Reply-To: <202202131445.XdLdkfL0-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7943103933038680539== 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: alsa-devel(a)alsa-project.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot sound/core/pcm_lib.c:77:35-36: 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: b81b1829e7e39f6cebdf6e4d5484eacbceda8554 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 12 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -74,7 +74,7 @@ void snd_pcm_playback_silence(struct snd snd_pcm_sframes_t avail =3D snd_pcm_playback_hw_avail(runtime); if (avail > runtime->buffer_size) avail =3D runtime->buffer_size; - runtime->silence_filled =3D avail > 0 ? avail : 0; + runtime->silence_filled =3D max(avail, 0); runtime->silence_start =3D (runtime->status->hw_ptr + runtime->silence_filled) % runtime->boundary; --===============7943103933038680539==--