All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal/core: fix minmax.cocci warnings
  2022-05-08 18:29 drivers/thermal/thermal_sysfs.c:792:22-23: WARNING opportunity for max() kernel test robot
@ 2022-05-08 18:19 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-05-08 18:19 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: 0day robot <lkp@intel.com>
CC: Junwen Wu <wudaemon@163.com>

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

drivers/thermal/thermal_sysfs.c:792:22-23: WARNING opportunity for max()
drivers/thermal/thermal_sysfs.c:791:22-23: 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: Daniel Lezcano <daniel.lezcano@linaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://github.com/intel-lab-lkp/linux/commits/UPDATE-20220508-232600/Zhang-Rui/thermal-thermal_stats-skip-broken-trans_table/20220419-165035
head:   a9158ddd9f2a97e356583d0bdb81c4e6822e6ad7
commit: a9158ddd9f2a97e356583d0bdb81c4e6822e6ad7 thermal/core: change mm alloc method to avoid kernel warning
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

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

 drivers/thermal/thermal_sysfs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -788,8 +788,8 @@ static int find_show_state( int *nums, i
     int i, min = INT_MAX, max = 0;
     for( i = 0; i < numsSize; ++i )
     {
-        min = nums[i] < min ? nums[i] : min;
-        max = nums[i] > max ? nums[i] : max;
+        min = min(nums[i], min);
+        max = max(nums[i], max);
     }
     int l = min, r = max, mid, cnt = 0;
     while( l < r )

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

* drivers/thermal/thermal_sysfs.c:792:22-23: WARNING opportunity for max()
@ 2022-05-08 18:29 kernel test robot
  2022-05-08 18:19 ` [PATCH] thermal/core: fix minmax.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2022-05-08 18:29 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: 0day robot <lkp@intel.com>
CC: Junwen Wu <wudaemon@163.com>

tree:   https://github.com/intel-lab-lkp/linux/commits/UPDATE-20220508-232600/Zhang-Rui/thermal-thermal_stats-skip-broken-trans_table/20220419-165035
head:   a9158ddd9f2a97e356583d0bdb81c4e6822e6ad7
commit: a9158ddd9f2a97e356583d0bdb81c4e6822e6ad7 thermal/core: change mm alloc method to avoid kernel warning
date:   3 hours ago
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: microblaze-randconfig-c023-20220508 (https://download.01.org/0day-ci/archive/20220509/202205090246.oJQBzerq-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.3.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 >>)
>> drivers/thermal/thermal_sysfs.c:792:22-23: WARNING opportunity for max()
>> drivers/thermal/thermal_sysfs.c:791:22-23: WARNING opportunity for min()

Please review and possibly fold the followup patch.

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

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

end of thread, other threads:[~2022-05-08 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08 18:29 drivers/thermal/thermal_sysfs.c:792:22-23: WARNING opportunity for max() kernel test robot
2022-05-08 18:19 ` [PATCH] thermal/core: fix minmax.cocci warnings 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.