drm/amd/powerplay: fix pcie sysfs interface when set wrong value

The operation of mutex_unlock smu->mutex should be done when forced
level is larger than NUM_LINK_LEVELS in the function of force_clk_levels.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Likun Gao 2019-03-04 10:46:27 +08:00 committed by Alex Deucher
parent 24bf582e27
commit db65e887fe
1 changed files with 4 additions and 2 deletions

View File

@ -1200,8 +1200,10 @@ static int vega20_force_clk_levels(struct smu_context *smu,
case PP_PCIE:
if (soft_min_level >= NUM_LINK_LEVELS ||
soft_max_level >= NUM_LINK_LEVELS)
return -EINVAL;
soft_max_level >= NUM_LINK_LEVELS) {
ret = -EINVAL;
break;
}
ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetMinLinkDpmByIndex, soft_min_level);