public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/vmem: Use swap() instead of open coding it
@ 2023-01-17  6:02 Jiapeng Chong
  2023-01-17  8:44 ` Heiko Carstens
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-01-17  6:02 UTC (permalink / raw)
  To: agordeev
  Cc: gerald.schaefer, hca, gor, borntraeger, svens, linux-s390,
	linux-kernel, Jiapeng Chong, Abaci Robot

Swap is a function interface that provides exchange function. To avoid
code duplication, we can use swap function.

./arch/s390/mm/vmem.c:680:10-11: WARNING opportunity for swap().

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3786
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 arch/s390/mm/vmem.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 78d7768f93d7..774a71b94f5c 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -674,11 +674,8 @@ static void __init memblock_region_swap(void *a, void *b, int size)
 {
 	struct memblock_region *r1 = a;
 	struct memblock_region *r2 = b;
-	struct memblock_region swap;
 
-	swap = *r1;
-	*r1 = *r2;
-	*r2 = swap;
+	swap(*r1, *r2);
 }
 
 /*
-- 
2.20.1.7.g153144c


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

end of thread, other threads:[~2023-01-17  8:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-17  6:02 [PATCH] s390/vmem: Use swap() instead of open coding it Jiapeng Chong
2023-01-17  8:44 ` Heiko Carstens

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