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: Mon, 07 Feb 2022 19:05:53 +0800	[thread overview]
Message-ID: <20220207110553.GA30025@1888b2a24206> (raw)
In-Reply-To: <202202071945.JZbBdwbE-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1851 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: linux-kernel(a)vger.kernel.org

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

lib/bch.c:842:7-8: WARNING opportunity for swap()
lib/bch.c:849:7-8: WARNING opportunity for swap()
lib/bch.c:518:22-23: 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:   dfd42facf1e4ada021b939b4e19c935dcdd55566
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 15 hours ago
:::::: commit date: 9 months ago

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

 bch.c |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

--- a/lib/bch.c
+++ b/lib/bch.c
@@ -513,11 +513,9 @@ static int solve_linear_system(struct bc
 		/* find suitable row for elimination */
 		for (r = p; r < m; r++) {
 			if (rows[r] & mask) {
-				if (r != p) {
-					tmp = rows[r];
-					rows[r] = rows[p];
-					rows[p] = tmp;
-				}
+				if (r != p)
+					
+					swap(rows[r], rows[p]);
 				rem = r+1;
 				break;
 			}
@@ -837,17 +835,13 @@ static struct gf_poly *gf_poly_gcd(struc
 
 	dbg("gcd(%s,%s)=", gf_poly_str@, gf_poly_str(b));
 
-	if (a->deg < b->deg) {
-		tmp = b;
-		b = a;
-		a = tmp;
-	}
+	if (a->deg < b->deg)
+		
+		swap(b, a);
 
 	while (b->deg > 0) {
 		gf_poly_mod(bch, a, b, NULL);
-		tmp = b;
-		b = a;
-		a = tmp;
+		swap(b, a);
 	}
 
 	dbg("%s\n", gf_poly_str(a));

  reply	other threads:[~2022-02-07 11:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 11:12 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
2022-02-07 11:05 ` kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-08 17:43 kernel test robot
2022-02-08 17:35 ` [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-12 10:32 drivers/leds/leds-tca6507.c:246:14-15: WARNING opportunity for swap() kernel test robot
2021-11-12 10:32 ` [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=20220207110553.GA30025@1888b2a24206 \
    --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.