All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coccinelle: misc: fix minmax.cocci warnings
  2022-04-23 11:53 arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max() kernel test robot
@ 2022-04-23 11:44 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-23 11:44 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1996 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: linuxppc-dev(a)lists.ozlabs.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

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 <efremov@linux.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c00c5e1d157bec0ef0b0b59aa5482eb8dc7e8e49
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
:::::: branch date: 10 hours ago
:::::: commit date: 12 months ago

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

 arch/powerpc/kernel/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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max()
@ 2022-04-23 11:53 kernel test robot
  2022-04-23 11:44 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-04-23 11:53 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c00c5e1d157bec0ef0b0b59aa5482eb8dc7e8e49
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
date:   12 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 12 months ago
config: powerpc64-randconfig-c003-20220422 (https://download.01.org/0day-ci/archive/20220423/202204231956.WqRUGmVT-lkp(a)intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max()
   arch/powerpc/kernel/sysfs.c:334:36-37: WARNING opportunity for max()

Please review and possibly fold the followup patch.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max()
@ 2022-02-08 21:58 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-08 21:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   555f3d7be91a873114c9656069f1a9fa476ec41a
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
date:   9 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 9 months ago
config: powerpc64-randconfig-c003-20220208 (https://download.01.org/0day-ci/archive/20220209/202202090521.NbGseFCj-lkp(a)intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max()
   arch/powerpc/kernel/sysfs.c:334:36-37: WARNING opportunity for max()

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-23 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 11:53 arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max() kernel test robot
2022-04-23 11:44 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-02-08 21:58 arch/powerpc/kernel/sysfs.c:456:36-37: WARNING opportunity for max() kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.