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