From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3090170942588395874==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Wed, 23 Feb 2022 03:51:47 +0800 Message-ID: <20220222195147.GA173468@086b3271c347> In-Reply-To: <202202230332.kEB4LBR9-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3090170942588395874== 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: David Airlie CC: Daniel Vetter CC: dri-devel(a)lists.freedesktop.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/gpu/drm/r128/r128_state.c:53: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: 917bbdb107f8767cb78f24e7d6725a2f93b9effe commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 80 minutes ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! drivers/gpu/drm/r128/r128_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/r128/r128_state.c +++ b/drivers/gpu/drm/r128/r128_state.c @@ -50,7 +50,7 @@ static void r128_emit_clip_rects(drm_r12 RING_LOCALS; DRM_DEBUG("\n"); = - BEGIN_RING((count < 3 ? count : 3) * 5 + 2); + BEGIN_RING(min(count, 3) * 5 + 2); = if (count >=3D 1) { OUT_RING(CCE_PACKET0(R128_AUX1_SC_LEFT, 3)); --===============3090170942588395874==--