From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rex.Zhu@amd.com
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/amd/powerplay: add vce state tables initialize for ppt v1.
Date: Thu, 13 Oct 2016 16:25:50 +0300 [thread overview]
Message-ID: <20161013132550.GA29097@mwanda> (raw)
Hello Rex Zhu,
The patch 48d7b759a8bc: "drm/amd/powerplay: add vce state tables
initialize for ppt v1." from Aug 31, 2016, leads to the following
static checker warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/process_pptables_v1_0.c:1211 ppt_get_num_of_vce_state_table_entries_v1_0()
warn: 'vce_state_table' can't be NULL.
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/process_pptables_v1_0.c
1200
1201 static int ppt_get_num_of_vce_state_table_entries_v1_0(struct pp_hwmgr *hwmgr)
1202 {
1203 const ATOM_Tonga_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
1204 const ATOM_Tonga_VCE_State_Table *vce_state_table =
1205 (ATOM_Tonga_VCE_State_Table *)(((unsigned long)pp_table) + le16_to_cpu(pp_table->usVCEStateTableOffset));
^^^^^^^^
pp_table can't be NULL because we're dereferencing it here. That
means vce_state_table can't be NULL either.
1206
1207 if (vce_state_table == NULL)
1208 return 0;
1209
1210 return vce_state_table->ucNumEntries;
1211 }
1212
A cleaner way to write this is maybe:
static int ppt_get_num_of_vce_state_table_entries_v1_0(struct pp_hwmgr *hwmgr)
{
const ATOM_Tonga_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
const ATOM_Tonga_VCE_State_Table *vce_state_table;
if (!pp_table)
return 0;
vce_state_table = (void *)pp_table + le16_to_cpu(pp_table->usVCEStateTableOffset);
return vce_state_table->ucNumEntries;
}
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2016-10-13 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 13:25 Dan Carpenter [this message]
2016-10-17 10:37 ` [bug report] drm/amd/powerplay: add vce state tables initialize for ppt v1 Zhu, Rex
2016-10-17 14:16 ` Christian König
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=20161013132550.GA29097@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Rex.Zhu@amd.com \
--cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.