linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/test_hmm: use min() to make code cleaner
@ 2022-02-15  9:15 cgel.zte
  0 siblings, 0 replies; only message in thread
From: cgel.zte @ 2022-02-15  9:15 UTC (permalink / raw)
  To: jglisse; +Cc: linux-mm, linux-kernel, Changcheng Deng, Zeal Robot

From: Changcheng Deng <deng.changcheng@zte.com.cn>

Use min() in order to make code cleaner.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
---
 lib/test_hmm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 361a026c5d21..cc1cdf79b09a 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -800,10 +800,7 @@ static int dmirror_exclusive(struct dmirror *dmirror,
 		unsigned long mapped;
 		int i;
 
-		if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT))
-			next = end;
-		else
-			next = addr + (ARRAY_SIZE(pages) << PAGE_SHIFT);
+		next = min(end, addr + (ARRAY_SIZE(pages) << PAGE_SHIFT));
 
 		ret = make_device_exclusive_range(mm, addr, next, pages, NULL);
 		mapped = dmirror_atomic_map(addr, next, pages, dmirror);
-- 
2.25.1



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

only message in thread, other threads:[~2022-02-15  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  9:15 [PATCH] lib/test_hmm: use min() to make code cleaner cgel.zte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).