Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/pm: clean up return types

count is size_t so don't use negative values.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+24 -15
+24 -15
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
··· 206 206 state = POWER_STATE_TYPE_BALANCED; 207 207 else if (strncmp("performance", buf, strlen("performance")) == 0) 208 208 state = POWER_STATE_TYPE_PERFORMANCE; 209 - else { 210 - count = -EINVAL; 211 - goto fail; 212 - } 209 + else 210 + return -EINVAL; 213 211 214 212 ret = pm_runtime_get_sync(ddev->dev); 215 213 if (ret < 0) ··· 229 231 pm_runtime_mark_last_busy(ddev->dev); 230 232 pm_runtime_put_autosuspend(ddev->dev); 231 233 232 - 233 - fail: 234 234 return count; 235 235 } 236 236 ··· 395 399 396 400 if (is_support_sw_smu(adev)) { 397 401 ret = smu_force_performance_level(&adev->smu, level); 398 - if (ret) 399 - count = -EINVAL; 402 + if (ret) { 403 + pm_runtime_mark_last_busy(ddev->dev); 404 + pm_runtime_put_autosuspend(ddev->dev); 405 + return -EINVAL; 406 + } 400 407 } else if (adev->powerplay.pp_funcs->force_performance_level) { 401 408 mutex_lock(&adev->pm.mutex); 402 409 if (adev->pm.dpm.thermal_active) { ··· 409 410 return -EINVAL; 410 411 } 411 412 ret = amdgpu_dpm_force_performance_level(adev, level); 412 - if (ret) 413 - count = -EINVAL; 414 - else 413 + if (ret) { 414 + mutex_unlock(&adev->pm.mutex); 415 + pm_runtime_mark_last_busy(ddev->dev); 416 + pm_runtime_put_autosuspend(ddev->dev); 417 + return -EINVAL; 418 + } else { 415 419 adev->pm.dpm.forced_level = level; 420 + } 416 421 mutex_unlock(&adev->pm.mutex); 417 422 } 418 423 pm_runtime_mark_last_busy(ddev->dev); ··· 893 890 894 891 if (is_support_sw_smu(adev)) { 895 892 ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask); 896 - if (ret) 897 - count = -EINVAL; 893 + if (ret) { 894 + pm_runtime_mark_last_busy(ddev->dev); 895 + pm_runtime_put_autosuspend(ddev->dev); 896 + return -EINVAL; 897 + } 898 898 } else if (adev->powerplay.pp_funcs->set_ppfeature_status) { 899 899 ret = amdgpu_dpm_set_ppfeature_status(adev, featuremask); 900 - if (ret) 901 - count = -EINVAL; 900 + if (ret) { 901 + pm_runtime_mark_last_busy(ddev->dev); 902 + pm_runtime_put_autosuspend(ddev->dev); 903 + return -EINVAL; 904 + } 902 905 } 903 906 pm_runtime_mark_last_busy(ddev->dev); 904 907 pm_runtime_put_autosuspend(ddev->dev);