Content-Type: multipart/mixed; boundary="===============6536836464194161544==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix swap.cocci warnings Date: Sun, 12 Dec 2021 08:37:27 +0800 Message-ID: <20211212003727.GA6883@665f7cac6c4a> List-Id: To: kbuild@lists.01.org --===============6536836464194161544== 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: Thomas Winischhofer 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/sis/sis_main.c:216:26-27: WARNING opportunity for swap() Check for opencoded swap() implementation. Generated by: scripts/coccinelle/misc/swap.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: bbdff6d583be718935b613ab2a966cddaadf661f commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap= script :::::: branch date: 3 hours ago :::::: commit date: 7 months ago Please take the patch only if it's a positive warning. Thanks! sis_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -212,9 +212,9 @@ static void sisfb_search_mode(char *name = /* This does some fuzzy mode naming detection */ if(sscanf(strbuf1, "%u %u %u %u", &xres, &yres, &depth, &rate) =3D=3D 4)= { - if((rate <=3D 32) || (depth > 32)) { - j =3D rate; rate =3D depth; depth =3D j; - } + if((rate <=3D 32) || (depth > 32)) + = + swap(rate, depth); sprintf(strbuf, "%ux%ux%u", xres, yres, depth); nameptr =3D strbuf; sisfb_parm_rate =3D rate; --===============6536836464194161544==--