diff --git a/sys/dev/drm/amd/powerplay/smumgr/tonga_smumgr.c b/sys/dev/drm/amd/powerplay/smumgr/tonga_smumgr.c --- a/sys/dev/drm/amd/powerplay/smumgr/tonga_smumgr.c +++ b/sys/dev/drm/amd/powerplay/smumgr/tonga_smumgr.c @@ -1317,7 +1317,8 @@ phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = pptable_info->mm_dep_table; - table->UvdLevelCount = (uint8_t) (mm_table->count); + table->UvdLevelCount = (uint8_t) min(mm_table->count, + (uint32_t)SMU72_MAX_LEVELS_UVD); table->UvdBootLevel = 0; for (count = 0; count < table->UvdLevelCount; count++) { @@ -1377,7 +1378,8 @@ phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = pptable_info->mm_dep_table; - table->VceLevelCount = (uint8_t) (mm_table->count); + table->VceLevelCount = (uint8_t) min(mm_table->count, + (uint32_t)SMU72_MAX_LEVELS_VCE); table->VceBootLevel = 0; for (count = 0; count < table->VceLevelCount; count++) { @@ -1422,7 +1424,8 @@ phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = pptable_info->mm_dep_table; - table->AcpLevelCount = (uint8_t) (mm_table->count); + table->AcpLevelCount = (uint8_t) min(mm_table->count, + (uint32_t)SMU72_MAX_LEVELS_ACP); table->AcpBootLevel = 0; for (count = 0; count < table->AcpLevelCount; count++) {