RE: [PATCH V2] drm/amdgpu: validate return value of pm_runtime_get_sync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - AMD Internal Distribution Only]

Sure Alex. Will do those changes and push the change.

Regards
Sunil Khatri

-----Original Message-----
From: Alex Deucher <alexdeucher@xxxxxxxxx>
Sent: Wednesday, March 5, 2025 1:11 AM
To: Khatri, Sunil <Sunil.Khatri@xxxxxxx>
Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Koenig, Christian <Christian.Koenig@xxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH V2] drm/amdgpu: validate return value of pm_runtime_get_sync

On Tue, Mar 4, 2025 at 2:32 PM Sunil Khatri <sunil.khatri@xxxxxxx> wrote:
>
> An invalid return value 'r' of the pm_runtime_get_sync is r < 0, so
> fix the return value check and add proper failure log and exit
> cleanly.
>
> Successful refcount in userqueue creation to make sure device remains
> in active state.
>

Fixes: 33d65834b02d ("drm/amdgpu/userq: handle runtime pm")

> Signed-off-by: Sunil Khatri <sunil.khatri@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index 3a71d01b54c9..7df50ff80f9b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -289,8 +289,11 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,
>         queue->userq_prop = userq_props;
>
>         r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
> -       if (r)
> +       if (r < 0) {
> +               drm_err(&adev->ddev, "Failed to increment ref count of
> + device pm_runtime\n");

I would use dev_err() here for consistency since we don't use the
drm_* variants that much.  Also update the error message so that it's clear where it's coming from.  E.g.,
"pm_runtime_get_sync() failed when creating userq\n"
With those fixed:
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> +               pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
>                 goto free_mqd;
> +       }
>
>         r = mqd_hw_default->init_mqd(adev, (void *)queue->mqd.cpu_ptr, userq_props);
>         if (r) {
> --
> 2.34.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux