coccinelle: misc: fix swap.cocci warnings
Subsystems (2)
kernel test robot
build botCC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Thomas Winischhofer <[email protected]>
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 <[email protected]>
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 <[email protected]>
Reported-by kernel test robot <[email protected]>
Signed-off-by kernel test robot <[email protected]>
---
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(-)
drivers/video/fbdev/sis/sis_main.c +3 -3
@@ -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) ==4 ) { -if ((rate <=32 ) || (depth >32 )) { - j = rate; rate = depth; depth = j; - } +if ((rate <=32 ) || (depth >32 )) + +swap (rate, depth);sprintf (strbuf,"%ux%ux%u" , xres, yres, depth); nameptr = strbuf; sisfb_parm_rate = rate;