linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: Felix.Kuehling@amd.com, airlied@linux.ie, Xinhui.Pan@amd.com,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org,
	alexander.deucher@amd.com, christian.koenig@amd.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] drm/amdkfd: Use max() instead of doing it manually
Date: Fri, 3 Dec 2021 11:42:06 +0200	[thread overview]
Message-ID: <YanmbhwDrdpu+Zup@intel.com> (raw)
In-Reply-To: <1638523913-117827-1-git-send-email-jiapeng.chong@linux.alibaba.com>

On Fri, Dec 03, 2021 at 05:31:53PM +0800, Jiapeng Chong wrote:
> Fix following coccicheck warning:
> 
> ./drivers/gpu/drm/amd/amdkfd/kfd_svm.c:2193:16-17: WARNING opportunity
> for max().
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index f2db49c..4f7e7b1 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -2190,7 +2190,7 @@ void schedule_deferred_list_work(struct svm_range_list *svms)
>  
>  	start = mni->interval_tree.start;
>  	last = mni->interval_tree.last;
> -	start = (start > range->start ? start : range->start) >> PAGE_SHIFT;
> +	start = max(start, range->start) >> PAGE_SHIFT;
>  	last = (last < (range->end - 1) ? last : range->end - 1) >> PAGE_SHIFT;

There's an open coded min() on the very next line.

>  	pr_debug("[0x%lx 0x%lx] range[0x%lx 0x%lx] notifier[0x%lx 0x%lx] %d\n",
>  		 start, last, range->start >> PAGE_SHIFT,
> -- 
> 1.8.3.1

-- 
Ville Syrjälä
Intel

      reply	other threads:[~2021-12-03  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  9:31 [PATCH] drm/amdkfd: Use max() instead of doing it manually Jiapeng Chong
2021-12-03  9:42 ` Ville Syrjälä [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YanmbhwDrdpu+Zup@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).