mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luben Tuikov <luben.tuikov@amd.com>
To: trix@redhat.com, alexander.deucher@amd.com,
	christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie,
	daniel@ffwll.ch, Hawking.Zhang@amd.com, Dennis.Li@amd.com,
	guchun.chen@amd.com, Stanley.Yang@amd.com, nirmoy.das@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, "Tuikov,
	Luben" <Luben.Tuikov@amd.com>
Subject: Re: [PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count() error count parameters
Date: Fri, 2 Jul 2021 18:51:27 -0400	[thread overview]
Message-ID: <a836cafa-86a9-3d72-1f02-f9f2d58ee127@amd.com> (raw)
In-Reply-To: <20210702195245.1629908-1-trix@redhat.com>

That's a good find, but I'd rather functions have no side effects. I'll follow up with a patch which correctly fixes this.

Regards,
Luben

On 2021-07-02 3:52 p.m., trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Static analysis reports this problem
> amdgpu_ras.c:2324:2: warning: 2nd function call argument is an
>   uninitialized value
>         atomic_set(&con->ras_ce_count, ce_count);
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ce_count is normally set by the earlier call to
> amdgpu_ras_query_error_count().  But amdgpu_ras_query_error_count()
> can return early without setting, leaving its error count parameters
> in a garbage state.
>
> Initialize the error count parameters earlier.
>
> Fixes: a46751fbcde5 ("drm/amdgpu: Fix RAS function interface")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 875874ea745ec..c80fa545aa2b8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1056,6 +1056,12 @@ void amdgpu_ras_query_error_count(struct amdgpu_device *adev,
>  	struct ras_manager *obj;
>  	unsigned long ce, ue;
>  
> +	if (ce_count)
> +		*ce_count = 0;
> +
> +	if (ue_count)
> +		*ue_count = 0;
> +
>  	if (!adev->ras_enabled || !con)
>  		return;
>  


  reply	other threads:[~2021-07-02 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 19:52 trix
2021-07-02 22:51 ` Luben Tuikov [this message]
2021-07-02 23:04   ` [PATCH] drm/amdgpu: Return error if no RAS Luben Tuikov
2021-07-06 15:25     ` Alex Deucher
2021-07-06 15:32       ` Luben Tuikov

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=a836cafa-86a9-3d72-1f02-f9f2d58ee127@amd.com \
    --to=luben.tuikov@amd.com \
    --cc=Dennis.Li@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Stanley.Yang@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=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guchun.chen@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nirmoy.das@amd.com \
    --cc=trix@redhat.com \
    /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

all inboxes | Powered by JetHome®