From: trix@redhat.com
To: 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,
luben.tuikov@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, Tom Rix <trix@redhat.com>
Subject: [PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count() error count parameters
Date: Fri, 2 Jul 2021 12:52:45 -0700 [thread overview]
Message-ID: <20210702195245.1629908-1-trix@redhat.com> (raw)
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;
--
2.26.3
next reply other threads:[~2021-07-02 19:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 19:52 trix [this message]
2021-07-02 22:51 ` [PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count() error count parameters Luben Tuikov
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=20210702195245.1629908-1-trix@redhat.com \
--to=trix@redhat.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=luben.tuikov@amd.com \
--cc=nirmoy.das@amd.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