[bug report] drm/amd/powerplay: add vce state tables initialize for ppt v1.
Christian König
deathsimple at vodafone.de
Mon Oct 17 14:16:10 UTC 2016
Reviewed-by: Christian König <christian.koenig at amd.com>.
Am 17.10.2016 um 12:37 schrieb Zhu, Rex:
> Thanks, please help to review the attached patch.
>
> Best Regards
> Rex
>
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter at oracle.com]
> Sent: Thursday, October 13, 2016 9:26 PM
> To: Zhu, Rex
> Cc: dri-devel at lists.freedesktop.org
> Subject: [bug report] drm/amd/powerplay: add vce state tables initialize for ppt v1.
>
> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20161017/5ed91f0f/attachment.html>
More information about the dri-devel
mailing list