aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2017-10-18 05:43:43 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-10-19 15:27:20 -0400
commit658b93913e7a8a8d418b6d1208e88ddacc4d245d (patch)
tree3db890cc798da1fb44422614f69f38a26a401db5 /drivers/gpu/drm/amd
parent1ed05ff4797a2935f04fbb4f465cd70a8a017709 (diff)
drm/amd/pp: Fix overflow when setup decf/pix/disp dpm table.
Clear the count in the single table setup function to avoid missing any tables. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 500f177254ac..0519338e0e5e 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -1161,6 +1161,8 @@ static void vega10_setup_default_single_dpm_table(struct pp_hwmgr *hwmgr,
1161{ 1161{
1162 int i; 1162 int i;
1163 1163
1164 dpm_table->count = 0;
1165
1164 for (i = 0; i < dep_table->count; i++) { 1166 for (i = 0; i < dep_table->count; i++) {
1165 if (i == 0 || dpm_table->dpm_levels[dpm_table->count - 1].value <= 1167 if (i == 0 || dpm_table->dpm_levels[dpm_table->count - 1].value <=
1166 dep_table->entries[i].clk) { 1168 dep_table->entries[i].clk) {
@@ -1269,10 +1271,6 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)
1269 return -EINVAL); 1271 return -EINVAL);
1270 1272
1271 /* Initialize Sclk DPM table based on allow Sclk values */ 1273 /* Initialize Sclk DPM table based on allow Sclk values */
1272 data->dpm_table.soc_table.count = 0;
1273 data->dpm_table.gfx_table.count = 0;
1274 data->dpm_table.dcef_table.count = 0;
1275
1276 dpm_table = &(data->dpm_table.soc_table); 1274 dpm_table = &(data->dpm_table.soc_table);
1277 vega10_setup_default_single_dpm_table(hwmgr, 1275 vega10_setup_default_single_dpm_table(hwmgr,
1278 dpm_table, 1276 dpm_table,