[PATCH v2] drivers/amd/pm: check the return value of amdgpu_bo_kmap

Quan, Evan Evan.Quan at amd.com
Thu Sep 22 04:23:05 UTC 2022


[AMD Official Use Only - General]

Reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: Li Zhong <floridsleeves at gmail.com>
> Sent: Thursday, September 22, 2022 12:18 PM
> To: dri-devel at lists.freedesktop.org; amd-gfx at lists.freedesktop.org
> Cc: jiapeng.chong at linux.alibaba.com; Powell, Darren
> <Darren.Powell at amd.com>; Chen, Guchun <Guchun.Chen at amd.com>;
> Limonciello, Mario <Mario.Limonciello at amd.com>; Quan, Evan
> <Evan.Quan at amd.com>; Lazar, Lijo <Lijo.Lazar at amd.com>; daniel at ffwll.ch;
> airlied at linux.ie; Pan, Xinhui <Xinhui.Pan at amd.com>; Koenig, Christian
> <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>; Li Zhong <floridsleeves at gmail.com>
> Subject: [PATCH v2] drivers/amd/pm: check the return value of
> amdgpu_bo_kmap
> 
> amdgpu_bo_kmap() returns error when fails to map buffer object. Add the
> error check and propagate the error.
> 
> Signed-off-by: Li Zhong <floridsleeves at gmail.com>
> ---
>  drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> index 1eb4e613b27a..ec055858eb95 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> @@ -1485,6 +1485,7 @@ static int pp_get_prv_buffer_details(void *handle,
> void **addr, size_t *size)
>  {
>  	struct pp_hwmgr *hwmgr = handle;
>  	struct amdgpu_device *adev = hwmgr->adev;
> +	int err;
> 
>  	if (!addr || !size)
>  		return -EINVAL;
> @@ -1492,7 +1493,9 @@ static int pp_get_prv_buffer_details(void *handle,
> void **addr, size_t *size)
>  	*addr = NULL;
>  	*size = 0;
>  	if (adev->pm.smu_prv_buffer) {
> -		amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
> +		err = amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
> +		if (err)
> +			return err;
>  		*size = adev->pm.smu_prv_buffer_size;
>  	}
> 
> --
> 2.25.1


More information about the amd-gfx mailing list