aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <[email protected]>2024-07-26 15:12:46 +0200
committerAndrew Morton <[email protected]>2024-09-01 20:25:52 -0700
commit592c9330e3692c9636adddfe17004870ae8dc434 (patch)
treea7f8058bd401a2f16a4a4714af03b843552309f1
parent073ebebd186250038a04be9693240f90f398c4b1 (diff)
lib: test_hmm: use min() to improve dmirror_exclusive()
Use min() to simplify the dmirror_exclusive() function and improve its readability. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Thorsten Blum <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Jérôme Glisse <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--lib/test_hmm.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index ee20e1f9bae9..056f2e411d7b 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -799,10 +799,7 @@ static int dmirror_exclusive(struct dmirror *dmirror,
unsigned long mapped = 0;
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);
/*