[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211124031632.35317-1-chi.minghao@zte.com.cn>
Date: Wed, 24 Nov 2021 03:16:32 +0000
From: cgel.zte@...il.com
To: akpm@...ux-foundation.org
Cc: shuah@...nel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
chiminghao <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH] selftests:vm: use swap() to make code cleaner
From: chiminghao <chi.minghao@....com.cn>
Fix the following coccicheck REVIEW:
./tools/testing/selftests/vm/userfaultfd.c:1531:21-22:use swap() to make
code cleaner
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: chiminghao <chi.minghao@....com.cn>
---
tools/testing/selftests/vm/userfaultfd.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 8a09057d2f22..dedbe9c9287e 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -1413,7 +1413,6 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize)
static int userfaultfd_stress(void)
{
void *area;
- char *tmp_area;
unsigned long nr;
struct uffdio_register uffdio_register;
struct uffd_stats uffd_stats[nr_cpus];
@@ -1524,13 +1523,9 @@ static int userfaultfd_stress(void)
count_verify[nr], nr);
/* prepare next bounce */
- tmp_area = area_src;
- area_src = area_dst;
- area_dst = tmp_area;
+ swap(area_src, area_dst);
- tmp_area = area_src_alias;
- area_src_alias = area_dst_alias;
- area_dst_alias = tmp_area;
+ swap(area_src_alias, area_dst_alias);
uffd_stats_report(uffd_stats, nr_cpus);
}
--
2.25.1
Powered by blists - more mailing lists