Skip to contentSkip to conversation

arch: x86: use swap()

PATCH New Vihas Mak 1 participant 1 message Nov 17, 2021

Subsystems (2)
lore
Share & tools
lore

Vihas Mak

author
#0 lore raw

PATCH 1/1 arch: x86: use swap()

Cocci gives following warning:

	arch/x86/kernel/unwind_orc.c:212:19-20: WARNING opportunity for swap()

Fix this by using swap() macro.

Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/kernel/unwind_orc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kernel/unwind_orc.c +1 -4
index a1202536f..a7aaf6bcf 100644
@@ -196,7 +196,6 @@ static struct orc_entry *cur_orc_table = __start_orc_unwind;
 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 *_b, int size)
 	/* 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)
Signature · 1 line
2.25.1