diff mbox series

lib/test_hmm: use min() to make code cleaner

Message ID 20220215091518.1776063-1-deng.changcheng@zte.com.cn (mailing list archive)
State New
Headers show
Series lib/test_hmm: use min() to make code cleaner | expand

Commit Message

CGEL Feb. 15, 2022, 9:15 a.m. UTC
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 mbox series

Patch

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);