mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arch: x86: use swap()
@ 2021-11-17 19:26 Vihas Mak
  0 siblings, 0 replies; only message in thread
From: Vihas Mak @ 2021-11-17 19:26 UTC (permalink / raw)
  To: tglx, mingo, bp, x86; +Cc: hpa, linux-kernel, makvihas

Cocci gives following warning:

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

Fix this by using swap() macro.

Signed-off-by: Vihas Mak <makvihas@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
 arch/x86/kernel/unwind_orc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index a1202536f..a7aaf6bcf 100644
--- 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 = __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)
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-17 19:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 19:26 [PATCH] arch: x86: use swap() Vihas Mak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®