All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coccinelle: misc: fix minmax.cocci warnings
  2022-02-22 19:56 drivers/gpu/drm/drm_bufs.c:740:33-34: WARNING opportunity for max() kernel test robot
@ 2022-02-22 19:51 ` kernel test robot
  2022-02-22 19:51 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-22 19:51 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1608 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>
CC: David Airlie <airlied@linux.ie>
CC: Daniel Vetter <daniel@ffwll.ch>
CC: dri-devel(a)lists.freedesktop.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/gpu/drm/r128/r128_state.c:53:19-20: 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: 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:   917bbdb107f8767cb78f24e7d6725a2f93b9effe
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
:::::: branch date: 80 minutes ago
:::::: commit date: 10 months ago

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

 drivers/gpu/drm/r128/r128_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/r128/r128_state.c
+++ b/drivers/gpu/drm/r128/r128_state.c
@@ -50,7 +50,7 @@ static void r128_emit_clip_rects(drm_r12
 	RING_LOCALS;
 	DRM_DEBUG("\n");
 
-	BEGIN_RING((count < 3 ? count : 3) * 5 + 2);
+	BEGIN_RING(min(count, 3) * 5 + 2);
 
 	if (count >= 1) {
 		OUT_RING(CCE_PACKET0(R128_AUX1_SC_LEFT, 3));

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

* [PATCH] coccinelle: misc: fix minmax.cocci warnings
  2022-02-22 19:56 drivers/gpu/drm/drm_bufs.c:740:33-34: WARNING opportunity for max() kernel test robot
  2022-02-22 19:51 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
@ 2022-02-22 19:51 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-22 19:51 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1627 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>
CC: David Airlie <airlied@linux.ie>
CC: Daniel Vetter <daniel@ffwll.ch>
CC: dri-devel(a)lists.freedesktop.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/gpu/drm/savage/savage_state.c:267:26-27: 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: 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:   917bbdb107f8767cb78f24e7d6725a2f93b9effe
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
:::::: branch date: 80 minutes ago
:::::: commit date: 10 months ago

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

 drivers/gpu/drm/savage/savage_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/savage/savage_state.c
+++ b/drivers/gpu/drm/savage/savage_state.c
@@ -264,7 +264,7 @@ static int savage_dispatch_state(drm_sav
 
 	do {
 		while (count > 0) {
-			unsigned int n = count < 255 ? count : 255;
+			unsigned int n = min(count, 255);
 			DMA_SET_REGISTERS(start, n);
 			DMA_COPY(regs, n);
 			count -= n;

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

* drivers/gpu/drm/drm_bufs.c:740:33-34: WARNING opportunity for max()
@ 2022-02-22 19:56 kernel test robot
  2022-02-22 19:51 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
  2022-02-22 19:51 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-22 19:56 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1483 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:   917bbdb107f8767cb78f24e7d6725a2f93b9effe
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script
date:   10 months ago
:::::: branch date: 80 minutes ago
:::::: commit date: 10 months ago
config: x86_64-randconfig-c004-20220221 (https://download.01.org/0day-ci/archive/20220223/202202230332.kEB4LBR9-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.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/gpu/drm/drm_bufs.c:740:33-34: WARNING opportunity for max()
   drivers/gpu/drm/drm_bufs.c:917:33-34: WARNING opportunity for max()
   drivers/gpu/drm/drm_bufs.c:1115:33-34: WARNING opportunity for max()
--
>> drivers/hid/hid-sony.c:1011:24-26: WARNING opportunity for min()
--
>> drivers/gpu/drm/r128/r128_state.c:53:19-20: WARNING opportunity for min()
--
>> drivers/gpu/drm/savage/savage_state.c:267:26-27: WARNING opportunity for min()

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-02-22 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 19:56 drivers/gpu/drm/drm_bufs.c:740:33-34: WARNING opportunity for max() kernel test robot
2022-02-22 19:51 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
2022-02-22 19:51 ` 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.