[PATCH v1] drivers/amd/kv_dpm: check the return value of amdgpu_kv_smc_bapm_enable

Lazar, Lijo lijo.lazar at amd.com
Fri Sep 23 03:04:22 UTC 2022



On 9/23/2022 1:36 AM, Li Zhong wrote:
> Check the return value of amdgpu_kv_smc_bapm_enable() and log the error
> when it fails.
> 
> Signed-off-by: Li Zhong <floridsleeves at gmail.com>
> ---
>   drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> index 8fd0782a2b20..d392256effe2 100644
> --- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> @@ -1384,13 +1384,16 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
>   static void kv_dpm_disable(struct amdgpu_device *adev)
>   {
>   	struct kv_power_info *pi = kv_get_pi(adev);
> +	int err;
>   
>   	amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
>   		       AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
>   	amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
>   		       AMDGPU_THERMAL_IRQ_HIGH_TO_LOW);
>   
> -	amdgpu_kv_smc_bapm_enable(adev, false);
> +	err = amdgpu_kv_smc_bapm_enable(adev, false);
> +	if (ret)
> +		DRM_ERROR("amdgpu_kv_smc_bapm_enable failed\n");

Return code is captured in 'err' and check is for ret' variable.

BTW, does this code compile?

Thanks,
Lijo

>   
>   	if (adev->asic_type == CHIP_MULLINS)
>   		kv_enable_nb_dpm(adev, false);
> 


More information about the amd-gfx mailing list