CC: [email protected]
CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Michael Ellerman <[email protected]>
CC: Benjamin Herrenschmidt <[email protected]>
CC: Paul Mackerras <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max()
arch/powerpc/kernel/sysfs.c:334:36-37: 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 <[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:   555f3d7be91a873114c9656069f1a9fa476ec41a
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax 
script
:::::: branch date: 22 hours ago
:::::: commit date: 9 months ago

Please take the patch only if it's a positive warning. Thanks!

 sysfs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -331,7 +331,7 @@ static ssize_t show_pw20_wait_time(struc
                time = pw20_wt;
        }
 
-       return sprintf(buf, "%llu\n", time > 0 ? time : 0);
+       return sprintf(buf, "%llu\n", max(time, 0));
 }
 
 static void set_pw20_wait_entry_bit(void *val)
@@ -453,7 +453,7 @@ static ssize_t show_altivec_idle_wait_ti
                time = altivec_idle_wt;
        }
 
-       return sprintf(buf, "%llu\n", time > 0 ? time : 0);
+       return sprintf(buf, "%llu\n", max(time, 0));
 }
 
 static void set_altivec_idle_wait_entry_bit(void *val)
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to