From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6517768359984405431==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Sat, 12 Feb 2022 18:04:06 +0800 Message-ID: <20220212100406.GA15117@147d4e5e278f> In-Reply-To: <202202121748.vOWEcbGM-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============6517768359984405431== 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: "Greg Kroah-Hartman" CC: Du Cheng CC: dri-devel(a)lists.freedesktop.org CC: linux-fbdev(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/video/fbdev/core/fbcon.c:605:16-17: 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: 83e396641110663d3c7bb25b9bc0c6a750359ecf 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! fbcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -602,7 +602,7 @@ static void fbcon_prepare_logo(struct vc save =3D kmalloc(array3_size(logo_lines, new_cols, 2), GFP_KERNEL); if (save) { - int i =3D cols < new_cols ? cols : new_cols; + int i =3D min(cols, new_cols); scr_memsetw(save, erase, array3_size(logo_lines, new_cols, 2)); r =3D q - step; for (cnt =3D 0; cnt < logo_lines; cnt++, r +=3D i) --===============6517768359984405431==--