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

From: cgel . zte
Date: Tue Feb 15 2022 - 04:15:28 EST


From: Changcheng Deng <deng.changcheng@xxxxxxxxxx>

Use min() in order to make code cleaner.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Changcheng Deng <deng.changcheng@xxxxxxxxxx>
---
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