<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2021-12-15 3:52 a.m.,
<a class="moz-txt-link-abbreviated" href="mailto:cgel.zte@gmail.com">cgel.zte@gmail.com</a> wrote:<br>
</div>
<blockquote type="cite" cite="mid:20211215085226.444116-1-deng.changcheng@zte.com.cn">
<pre class="moz-quote-pre" wrap="">From: Changcheng Deng <a class="moz-txt-link-rfc2396E" href="mailto:deng.changcheng@zte.com.cn"><deng.changcheng@zte.com.cn></a>
Use max() and min() in order to make code cleaner.
Reported-by: Zeal Robot <a class="moz-txt-link-rfc2396E" href="mailto:zealci@zte.com.cn"><zealci@zte.com.cn></a>
Signed-off-by: Changcheng Deng <a class="moz-txt-link-rfc2396E" href="mailto:deng.changcheng@zte.com.cn"><deng.changcheng@zte.com.cn></a></pre>
</blockquote>
<p>Reviewed-by: Philip Yang <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a></p>
<p>Applied, thanks.<br>
</p>
<blockquote type="cite" cite="mid:20211215085226.444116-1-deng.changcheng@zte.com.cn">
<pre class="moz-quote-pre" wrap="">
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 7e92dcea4ce8..c6d3555b5be6 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -2254,8 +2254,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni,
start = mni->interval_tree.start;
last = mni->interval_tree.last;
- start = (start > range->start ? start : range->start) >> PAGE_SHIFT;
- last = (last < (range->end - 1) ? last : range->end - 1) >> PAGE_SHIFT;
+ start = max(start, range->start) >> PAGE_SHIFT;
+ last = min(last, range->end - 1) >> PAGE_SHIFT;
pr_debug("[0x%lx 0x%lx] range[0x%lx 0x%lx] notifier[0x%lx 0x%lx] %d\n",
start, last, range->start >> PAGE_SHIFT,
(range->end - 1) >> PAGE_SHIFT,
</pre>
</blockquote>
</body>
</html>