All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] coccinelle: misc: fix swap.cocci warnings
Date: Fri, 12 Nov 2021 18:32:36 +0800	[thread overview]
Message-ID: <20211112103236.GA81230@a78ca601fa50> (raw)
In-Reply-To: <202111121846.5c9ZGPbP-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1445 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: Pavel Machek <pavel@ucw.cz>
CC: linux-leds(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/leds/leds-tca6507.c:246:14-15: WARNING opportunity for swap()


 Check for opencoded swap() implementation.

Generated by: scripts/coccinelle/misc/swap.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:   5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 11 hours ago
:::::: commit date: 7 months ago

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

 leds-tca6507.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -241,11 +241,9 @@ static int choose_times(int msec, int *c
 	}
 	if (diff < 65536) {
 		int actual;
-		if (msec & 1) {
-			c1 = *c2p;
-			*c2p = *c1p;
-			*c1p = c1;
-		}
+		if (msec & 1)
+			
+			swap(*c2p, *c1p);
 		actual = time_codes[*c1p] + time_codes[*c2p];
 		if (*c1p < *c2p)
 			return actual + 1;

  reply	other threads:[~2021-11-12 10:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 10:32 drivers/leds/leds-tca6507.c:246:14-15: WARNING opportunity for swap() kernel test robot
2021-11-12 10:32 ` kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-08 17:43 lib/bch.c:842:7-8: " kernel test robot
2022-02-08 17:35 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-02-07 11:12 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-02-07 11:05 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-02-01 20:12 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-02-01 20:02 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-31 12:17 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-31 12:13 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-28  7:28 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-28  7:19 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-28  4:50 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-28  4:40 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-25 12:39 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-25 12:34 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-23  2:36 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-23  2:27 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-22 20:15 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-22 18:27 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-20 16:24 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-20 16:15 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-19  9:01 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-19  8:55 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2022-01-18 11:13 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-01-18  8:17 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-12-31 17:42 kernel test robot
2021-12-16 14:00 kernel test robot
2021-12-13 17:02 kernel test robot
2021-12-12  0:37 kernel test robot
2021-12-11 14:08 kernel test robot
2021-12-07 10:15 kernel test robot
2021-11-27 18:42 kernel test robot
2021-11-13 12:20 arch/arc/kernel/unwind.c:251:22-23: WARNING opportunity for swap() kernel test robot
2021-11-13 12:20 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-11-11 20:49 arch/um/os-Linux/sigio.c:81:28-29: WARNING opportunity for swap() kernel test robot
2021-11-11 20:49 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-09-03 14:17 arch/ia64/kernel/setup.c:213:39-40: WARNING opportunity for swap() kernel test robot
2021-09-03 14:17 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-08-30 12:52 arch/parisc/mm/init.c:138:36-37: WARNING opportunity for swap() kernel test robot
2021-08-30 12:52 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-07-29 23:45 arch/x86/kernel/unwind_orc.c:212:16-17: WARNING opportunity for swap() kernel test robot
2021-07-29 23:46 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-07-18 19:14 arch/arc/kernel/unwind.c:251:22-23: WARNING opportunity for swap() kernel test robot
2021-07-18 19:14 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-07-13 23:10 drivers/net/ethernet/sfc/efx_channels.c:804:36-37: WARNING opportunity for swap() kernel test robot
2021-07-13 23:11 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
2021-07-07 22:21 fs/xfs/libxfs/xfs_da_btree.c:898:15-16: WARNING opportunity for swap() kernel test robot
2021-07-07 22:21 ` [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211112103236.GA81230@a78ca601fa50 \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.