All of lore.kernel.org
 help / color / mirror / Atom feed
* [jlawall:for-5.12 1/5] drivers/ata/libata-scsi.c:3594:10-11: WARNING opportunity for min()
@ 2021-04-24  1:32 kernel test robot
  2021-04-24  1:32 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-04-24  1:32 UTC (permalink / raw)
  To: kbuild

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

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12
head:   44e793b89bcfe586730f4c6ce3c66174dc07cb37
commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/5] coccinelle: misc: add minmax script
:::::: branch date: 15 hours ago
:::::: commit date: 5 weeks ago
config: i386-randconfig-c021-20210423 (attached as .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/ata/libata-scsi.c:3594:10-11: WARNING opportunity for min()
   drivers/ata/libata-scsi.c:3650:10-11: 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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37671 bytes --]

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

* [PATCH] coccinelle: misc: fix minmax.cocci warnings
  2021-04-24  1:32 [jlawall:for-5.12 1/5] drivers/ata/libata-scsi.c:3594:10-11: WARNING opportunity for min() kernel test robot
@ 2021-04-24  1:32 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-04-24  1:32 UTC (permalink / raw)
  To: kbuild

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

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

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

drivers/ata/libata-scsi.c:3594:10-11: WARNING opportunity for min()
drivers/ata/libata-scsi.c:3650:10-11: 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

Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script")
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/jlawall/linux.git for-5.12
head:   44e793b89bcfe586730f4c6ce3c66174dc07cb37
commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/5] coccinelle: misc: add minmax script
:::::: branch date: 15 hours ago
:::::: commit date: 5 weeks ago

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

 libata-scsi.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3591,10 +3591,7 @@ static int ata_mselect_caching(struct at
 	 */
 
 	if (len != CACHE_MPAGE_LEN - 2) {
-		if (len < CACHE_MPAGE_LEN - 2)
-			*fp = len;
-		else
-			*fp = CACHE_MPAGE_LEN - 2;
+		*fp = min(len, CACHE_MPAGE_LEN - 2);
 		return -EINVAL;
 	}
 
@@ -3647,10 +3644,7 @@ static int ata_mselect_control(struct at
 	 */
 
 	if (len != CONTROL_MPAGE_LEN - 2) {
-		if (len < CONTROL_MPAGE_LEN - 2)
-			*fp = len;
-		else
-			*fp = CONTROL_MPAGE_LEN - 2;
+		*fp = min(len, CONTROL_MPAGE_LEN - 2);
 		return -EINVAL;
 	}
 

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

end of thread, other threads:[~2021-04-24  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24  1:32 [jlawall:for-5.12 1/5] drivers/ata/libata-scsi.c:3594:10-11: WARNING opportunity for min() kernel test robot
2021-04-24  1:32 ` [PATCH] coccinelle: misc: 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.