From: Tim Huang <tim.huang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <alexander.deucher@amd.com>, <christian.koenig@amd.com>,
<jesse.zhang@amd.com>, <bob.zhou@amd.com>,
Tim Huang <tim.huang@amd.com>
Subject: [PATCH 2/2] drm/amd/pm: ensure the fw_info is not null before using it
Date: Fri, 9 Aug 2024 15:34:25 +0800 [thread overview]
Message-ID: <20240809073425.54632-2-tim.huang@amd.com> (raw)
In-Reply-To: <20240809073425.54632-1-tim.huang@amd.com>
This resolves the dereference null return value warning
reported by Coverity.
Signed-off-by: Tim Huang <tim.huang@amd.com>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
index ca1c7ae8d146..f06b29e33ba4 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
@@ -1183,6 +1183,8 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,
fw_info = smu_atom_get_data_table(hwmgr->adev,
GetIndexIntoMasterTable(DATA, FirmwareInfo),
&size, &frev, &crev);
+ PP_ASSERT_WITH_CODE(fw_info != NULL,
+ "Missing firmware info!", return -EINVAL);
if ((fw_info->ucTableFormatRevision == 1)
&& (le16_to_cpu(fw_info->usStructureSize) >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))
--
2.43.0
next prev parent reply other threads:[~2024-08-09 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 7:34 [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it Tim Huang
2024-08-09 7:34 ` Tim Huang [this message]
2024-08-14 8:59 ` [PATCH 2/2] drm/amd/pm: ensure the fw_info " Zhang, Jesse(Jie)
2024-08-14 8:59 ` [PATCH 1/2] drm/amdgpu: ensure the connector " Zhang, Jesse(Jie)
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=20240809073425.54632-2-tim.huang@amd.com \
--to=tim.huang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bob.zhou@amd.com \
--cc=christian.koenig@amd.com \
--cc=jesse.zhang@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