All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-12-31 17:42 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-12-31 17:42 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1690 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: Michael Ellerman <mpe@ellerman.id.au>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Xiongwei Song <sxwjean@gmail.com>
CC: Nathan Chancellor <nathan@kernel.org>
CC: linuxppc-dev(a)lists.ozlabs.org
CC: linux-kernel(a)vger.kernel.org

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

arch/powerpc/kernel/fadump.c:1285:34-35: 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:   4f3d93c6eaff6b84e43b63e0d7a119c5920e1020
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 15 hours ago
:::::: commit date: 8 months ago

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

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

--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1280,11 +1280,9 @@ static void sort_and_merge_mem_ranges(st
 			if (mem_ranges[idx].base > mem_ranges[j].base)
 				idx = j;
 		}
-		if (idx != i) {
-			tmp_range = mem_ranges[idx];
-			mem_ranges[idx] = mem_ranges[i];
-			mem_ranges[i] = tmp_range;
-		}
+		if (idx != i)
+			
+			swap(mem_ranges[idx], mem_ranges[i]);
 	}
 
 	/* Merge adjacent reserved ranges */

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-02-08 17:43 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-02-08 17:35 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-02-08 17:35 UTC (permalink / raw)
  To: kbuild

[-- 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:   555f3d7be91a873114c9656069f1a9fa476ec41a
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 18 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-02-07 11:05 UTC (permalink / raw)
  To: kbuild

[-- 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-02-01 20:12 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-02-01 20:02 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-02-01 20:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1849 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:   26291c54e111ff6ba87a164d85d4a4e134b7315c
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 2 days 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-31 12:17 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-31 12:13 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-31 12:13 UTC (permalink / raw)
  To: kbuild

[-- 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:   26291c54e111ff6ba87a164d85d4a4e134b7315c
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 23 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-28  7:28 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-28  7:19 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-28  7:19 UTC (permalink / raw)
  To: kbuild

[-- 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:   23a46422c56144939c091c76cf389aa863ce9c18
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 12 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-28  4:50 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-28  4:40 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-28  4:40 UTC (permalink / raw)
  To: kbuild

[-- 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:   23a46422c56144939c091c76cf389aa863ce9c18
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 10 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-25 12:39 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-25 12:34 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-25 12:34 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1850 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:   a08b41ab9e2e468647f78eb17c28e29b93006394
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 7 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-23  2:36 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-23  2:27 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-23  2:27 UTC (permalink / raw)
  To: kbuild

[-- 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:   1c52283265a462a100ae63ddf58b4e5884acde86
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 17 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-22 20:15 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-22 18:27 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-22 18:27 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1850 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:   1c52283265a462a100ae63ddf58b4e5884acde86
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 9 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-20 16:24 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-20 16:15 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-20 16:15 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1850 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:   64f29d8856a9e0d1fcdc5344f76e70c364b941cb
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 4 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-19  9:01 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-19  8:55 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-19  8:55 UTC (permalink / raw)
  To: kbuild

[-- 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:   99613159ad749543621da8238acf1a122880144e
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 21 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  2022-01-18 11:13 lib/bch.c:842:7-8: WARNING opportunity for swap() kernel test robot
@ 2022-01-18  8:17 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2022-01-18  8:17 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1850 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:   e3a8b6a1e70c37702054ae3c7c07ed828435d8ee
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 4 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-12-16 14:00 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-12-16 14:00 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1690 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: Michael Ellerman <mpe@ellerman.id.au>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Nathan Chancellor <nathan@kernel.org>
CC: Xiongwei Song <sxwjean@gmail.com>
CC: linuxppc-dev(a)lists.ozlabs.org
CC: linux-kernel(a)vger.kernel.org

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

arch/powerpc/kernel/fadump.c:1285:34-35: 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:   2b14864acbaaf03d9c01982e243a84632524c3ac
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 19 hours ago
:::::: commit date: 8 months ago

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

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

--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1280,11 +1280,9 @@ static void sort_and_merge_mem_ranges(st
 			if (mem_ranges[idx].base > mem_ranges[j].base)
 				idx = j;
 		}
-		if (idx != i) {
-			tmp_range = mem_ranges[idx];
-			mem_ranges[idx] = mem_ranges[i];
-			mem_ranges[i] = tmp_range;
-		}
+		if (idx != i)
+			
+			swap(mem_ranges[idx], mem_ranges[i]);
 	}
 
 	/* Merge adjacent reserved ranges */

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-12-13 17:02 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-12-13 17:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1588 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: Jeff Dike <jdike@addtoit.com>
CC: Richard Weinberger <richard@nod.at>
CC: Anton Ivanov <anton.ivanov@cambridgegreys.com>
CC: Johannes Berg <johannes.berg@intel.com>
CC: linux-um(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org

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

arch/um/os-Linux/sigio.c:81:28-29: 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:   2585cf9dfaaddf00b069673f27bb3f8530e2039c
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 18 hours ago
:::::: commit date: 8 months ago

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

 sigio.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -77,9 +77,7 @@ static int write_sigio_thread(void *unus
 					       "write_sigio_thread : "
 					       "read on socket failed, "
 					       "err = %d\n", errno);
-				tmp = current_poll;
-				current_poll = next_poll;
-				next_poll = tmp;
+				swap(current_poll, next_poll);
 				respond_fd = sigio_private[1];
 			}
 			else {

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-12-12  0:37 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-12-12  0:37 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1648 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: Thomas Winischhofer <thomas@winischhofer.net>
CC: dri-devel(a)lists.freedesktop.org
CC: linux-fbdev(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/video/fbdev/sis/sis_main.c:216:26-27: 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:   bbdff6d583be718935b613ab2a966cddaadf661f
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 3 hours ago
:::::: commit date: 7 months ago

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

 sis_main.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -212,9 +212,9 @@ static void sisfb_search_mode(char *name
 
 		/* This does some fuzzy mode naming detection */
 		if(sscanf(strbuf1, "%u %u %u %u", &xres, &yres, &depth, &rate) == 4) {
-			if((rate <= 32) || (depth > 32)) {
-				j = rate; rate = depth; depth = j;
-			}
+			if((rate <= 32) || (depth > 32))
+				
+				swap(rate, depth);
 			sprintf(strbuf, "%ux%ux%u", xres, yres, depth);
 			nameptr = strbuf;
 			sisfb_parm_rate = rate;

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-12-11 14:08 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-12-11 14:08 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1618 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: Evgeniy Polyakov <zbr@ioremap.net>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
CC: Dan Carpenter <error27@gmail.com>
CC: Bhaskar Chowdhury <unixbhaskar@gmail.com>
CC: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru>
CC: Randy Dunlap <rdunlap@infradead.org>
CC: linux-kernel(a)vger.kernel.org

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

drivers/w1/slaves/w1_therm.c:1840:18-19: 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:   6f513529296fd4f696afb4354c46508abe646541
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 13 hours ago
:::::: commit date: 7 months ago

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

 w1_therm.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -1836,9 +1836,9 @@ static ssize_t alarms_store(struct devic
 	th = int_to_short(temp);
 
 	/* Reorder if required th and tl */
-	if (tl > th) {
-		tt = tl; tl = th; th = tt;
-	}
+	if (tl > th)
+		
+		swap(tl, th);
 
 	/*
 	 * Read the scratchpad to change only the required bits

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-12-07 10:15 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-12-07 10:15 UTC (permalink / raw)
  To: kbuild

[-- 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:   cd8c917a56f20f48748dd43d9ae3caff51d5b987
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 10 hours ago
:::::: commit date: 7 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));

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
@ 2021-11-27 18:42 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-11-27 18:42 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1925 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: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: x86(a)kernel.org
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Josh Poimboeuf <jpoimboe@redhat.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Miroslav Benes <mbenes@suse.cz>

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

arch/x86/kernel/unwind_orc.c:212:16-17: 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:   c5c17547b778975b3d83a73c8d84e8fb5ecf3ba5
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 22 hours ago
:::::: commit date: 7 months ago

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

 unwind_orc.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -196,7 +196,6 @@ static struct orc_entry *cur_orc_table =
 static void orc_sort_swap(void *_a, void *_b, int size)
 {
 	struct orc_entry *orc_a, *orc_b;
-	struct orc_entry orc_tmp;
 	int *a = _a, *b = _b, tmp;
 	int delta = _b - _a;
 
@@ -208,9 +207,7 @@ static void orc_sort_swap(void *_a, void
 	/* Swap the corresponding .orc_unwind entries: */
 	orc_a = cur_orc_table + (a - cur_orc_ip_table);
 	orc_b = cur_orc_table + (b - cur_orc_ip_table);
-	orc_tmp = *orc_a;
-	*orc_a = *orc_b;
-	*orc_b = orc_tmp;
+	swap(*orc_a, *orc_b);
 }
 
 static int orc_sort_cmp(const void *_a, const void *_b)

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-11-13 12:20 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1604 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: Vineet Gupta <vgupta@synopsys.com>
CC: "dean.yang_cp" <yangdianqing@yulong.com>
CC: linux-snps-arc(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org

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

arch/arc/kernel/unwind.c:251:22-23: WARNING opportunity for swap()
arch/arc/kernel/unwind.c:254:18-19: 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:   66f4beaa6c1d28161f534471484b2daa2de1dce0
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 16 hours ago
:::::: commit date: 7 months ago

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

 unwind.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -247,12 +247,8 @@ static void swap_eh_frame_hdr_table_entr
 	struct eh_frame_hdr_table_entry *e2 = p2;
 	unsigned long v;
 
-	v = e1->start;
-	e1->start = e2->start;
-	e2->start = v;
-	v = e1->fde;
-	e1->fde = e2->fde;
-	e2->fde = v;
+	swap(e1->start, e2->start);
+	swap(e1->fde, e2->fde);
 }
 
 static void init_unwind_hdr(struct unwind_table *table,

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-11-12 10:32 UTC (permalink / raw)
  To: kbuild

[-- 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;

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-11-11 20:49 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1588 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: Jeff Dike <jdike@addtoit.com>
CC: Richard Weinberger <richard@nod.at>
CC: Anton Ivanov <anton.ivanov@cambridgegreys.com>
CC: Johannes Berg <johannes.berg@intel.com>
CC: linux-um(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org

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

arch/um/os-Linux/sigio.c:81:28-29: 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:   debe436e77c72fcee804fb867f275e6d31aa999c
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 20 hours ago
:::::: commit date: 6 months ago

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

 sigio.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -77,9 +77,7 @@ static int write_sigio_thread(void *unus
 					       "write_sigio_thread : "
 					       "read on socket failed, "
 					       "err = %d\n", errno);
-				tmp = current_poll;
-				current_poll = next_poll;
-				next_poll = tmp;
+				swap(current_poll, next_poll);
 				respond_fd = sigio_private[1];
 			}
 			else {

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-09-03 14:17 UTC (permalink / raw)
  To: kbuild

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

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

arch/ia64/kernel/setup.c:213:39-40: 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:   a9c9a6f741cdaa2fa9ba24a790db8d07295761e3
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 16 hours ago
:::::: commit date: 4 months ago

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

 setup.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -209,9 +209,7 @@ sort_regions (struct rsvd_region *rsvd_r
 		for (j = 0; j < max; ++j) {
 			if (rsvd_region[j].start > rsvd_region[j+1].start) {
 				struct rsvd_region tmp;
-				tmp = rsvd_region[j];
-				rsvd_region[j] = rsvd_region[j + 1];
-				rsvd_region[j + 1] = tmp;
+				swap(rsvd_region[j], rsvd_region[j + 1]);
 			}
 		}
 	}

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-08-30 12:52 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1591 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: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
CC: Helge Deller <deller@gmx.de>
CC: Nick Desaulniers <ndesaulniers@gooogle.com>
CC: Russell King <rmk+kernel@armlinux.org.uk>
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: Christophe Leroy <christophe.leroy@c-s.fr>
CC: Mike Rapoport <rppt@kernel.org>
CC: Joe Perches <joe@perches.com>

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

arch/parisc/mm/init.c:138:36-37: 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:   7d2a07b769330c34b4deabeed939325c77a7ec2f
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 15 hours ago
:::::: commit date: 4 months ago

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

 init.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -134,9 +134,7 @@ static void __init setup_bootmem(void)
 
 				break;
 			}
-			tmp = pmem_ranges[j-1];
-			pmem_ranges[j-1] = pmem_ranges[j];
-			pmem_ranges[j] = tmp;
+			swap(pmem_ranges[j - 1], pmem_ranges[j]);
 		}
 	}
 

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-07-29 23:46 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1924 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: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: x86(a)kernel.org
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Josh Poimboeuf <jpoimboe@redhat.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Miroslav Benes <mbenes@suse.cz>

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

arch/x86/kernel/unwind_orc.c:212:16-17: 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:   7e96bf476270aecea66740a083e51b38c1371cd2
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 7 hours ago
:::::: commit date: 3 months ago

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

 unwind_orc.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -196,7 +196,6 @@ static struct orc_entry *cur_orc_table =
 static void orc_sort_swap(void *_a, void *_b, int size)
 {
 	struct orc_entry *orc_a, *orc_b;
-	struct orc_entry orc_tmp;
 	int *a = _a, *b = _b, tmp;
 	int delta = _b - _a;
 
@@ -208,9 +207,7 @@ static void orc_sort_swap(void *_a, void
 	/* Swap the corresponding .orc_unwind entries: */
 	orc_a = cur_orc_table + (a - cur_orc_ip_table);
 	orc_b = cur_orc_table + (b - cur_orc_ip_table);
-	orc_tmp = *orc_a;
-	*orc_a = *orc_b;
-	*orc_b = orc_tmp;
+	swap(*orc_a, *orc_b);
 }
 
 static int orc_sort_cmp(const void *_a, const void *_b)

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-07-18 19:14 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1655 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: Vineet Gupta <vgupta@synopsys.com>
CC: "dean.yang_cp" <yangdianqing@yulong.com>
CC: "Gustavo A. R. Silva" <gustavoars@kernel.org>
CC: linux-snps-arc(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org

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

arch/arc/kernel/unwind.c:251:22-23: WARNING opportunity for swap()
arch/arc/kernel/unwind.c:254:18-19: 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:   1d67c8d993baf8ab6be8a2154b1a94ec1311c869
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 20 hours ago
:::::: commit date: 3 months ago

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

 unwind.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -247,12 +247,8 @@ static void swap_eh_frame_hdr_table_entr
 	struct eh_frame_hdr_table_entry *e2 = p2;
 	unsigned long v;
 
-	v = e1->start;
-	e1->start = e2->start;
-	e2->start = v;
-	v = e1->fde;
-	e1->fde = e2->fde;
-	e2->fde = v;
+	swap(e1->start, e2->start);
+	swap(e1->fde, e2->fde);
 }
 
 static void init_unwind_hdr(struct unwind_table *table,

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-07-13 23:11 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2231 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: Edward Cree <ecree.xilinx@gmail.com>
CC: Martin Habets <habetsm.xilinx@gmail.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: netdev(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

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

drivers/net/ethernet/sfc/efx_channels.c:804:36-37: WARNING opportunity for swap()
drivers/net/ethernet/sfc/efx_channels.c:850:36-37: 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:   40226a3d96ef8ab8980f032681c8bfd46d63874e
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 4 hours ago
:::::: commit date: 2 months ago

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

 efx_channels.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

--- a/drivers/net/ethernet/sfc/efx_channels.c
+++ b/drivers/net/ethernet/sfc/efx_channels.c
@@ -799,11 +799,9 @@ int efx_realloc_channels(struct efx_nic
 	old_txq_entries = efx->txq_entries;
 	efx->rxq_entries = rxq_entries;
 	efx->txq_entries = txq_entries;
-	for (i = 0; i < efx->n_channels; i++) {
-		channel = efx->channel[i];
-		efx->channel[i] = other_channel[i];
-		other_channel[i] = channel;
-	}
+	for (i = 0; i < efx->n_channels; i++)
+		
+		swap(efx->channel[i], other_channel[i]);
 
 	/* Restart buffer table allocation */
 	efx->next_buffer_table = next_buffer_table;
@@ -845,11 +843,9 @@ rollback:
 	/* Swap back */
 	efx->rxq_entries = old_rxq_entries;
 	efx->txq_entries = old_txq_entries;
-	for (i = 0; i < efx->n_channels; i++) {
-		channel = efx->channel[i];
-		efx->channel[i] = other_channel[i];
-		other_channel[i] = channel;
-	}
+	for (i = 0; i < efx->n_channels; i++)
+		
+		swap(efx->channel[i], other_channel[i]);
 	goto out;
 }
 

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

* [PATCH] coccinelle: misc: fix swap.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2021-07-07 22:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1689 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: "Darrick J. Wong" <djwong@kernel.org>
CC: linux-xfs(a)vger.kernel.org
CC: Carlos Maiolino <cmaiolino@redhat.com>
CC: Dave Chinner <dchinner@redhat.com>
CC: linux-kernel(a)vger.kernel.org

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

fs/xfs/libxfs/xfs_da_btree.c:898:15-16: 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:   a931dd33d370896a683236bba67c0d6f3d01144d
commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script
:::::: branch date: 4 hours ago
:::::: commit date: 10 weeks ago

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

 xfs_da_btree.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -894,9 +894,7 @@ xfs_da3_node_rebalance(
 	    ((be32_to_cpu(btree2[0].hashval) < be32_to_cpu(btree1[0].hashval)) ||
 	     (be32_to_cpu(btree2[nodehdr2.count - 1].hashval) <
 			be32_to_cpu(btree1[nodehdr1.count - 1].hashval)))) {
-		tmpnode = node1;
-		node1 = node2;
-		node2 = tmpnode;
+		swap(node1, node2);
 		xfs_da3_node_hdr_from_disk(dp->i_mount, &nodehdr1, node1);
 		xfs_da3_node_hdr_from_disk(dp->i_mount, &nodehdr2, node2);
 		btree1 = nodehdr1.btree;

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

end of thread, other threads:[~2022-02-08 17:35 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 17:42 [PATCH] coccinelle: misc: fix swap.cocci warnings kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-02-08 17:43 lib/bch.c:842:7-8: WARNING opportunity for swap() 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-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

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.