Commit 04cfc0c8 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher
Browse files

drm/amd/powerplay: fix the issue of checking on message mapping



The vega20_message_map[index] scope should be in PPSMC_Message_Count not in
SMU_MSG_MAX_COUNT.

Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d4631cba
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -131,10 +131,15 @@ static int vega20_message_map[SMU_MSG_MAX_COUNT] = {

static int vega20_get_smu_msg_index(struct smu_context *smc, uint32_t index)
{
	if (index > SMU_MSG_MAX_COUNT || index > PPSMC_Message_Count)
	int val;
	if (index > SMU_MSG_MAX_COUNT)
		return -EINVAL;
	return vega20_message_map[index];

	val = vega20_message_map[index];
	if (val > PPSMC_Message_Count)
		return -EINVAL;

	return val;
}

static int vega20_allocate_dpm_context(struct smu_context *smu)