From: "Khatri, Sunil" <sukhatri@amd.com>
To: "Sunil Khatri" <sunil.khatri@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/userq: use pm_runtime_resume_and_get and fix err handling
Date: Mon, 13 Apr 2026 11:52:27 +0530 [thread overview]
Message-ID: <39bb946a-a327-4e75-8900-883a4e37a9ae@amd.com> (raw)
In-Reply-To: <20260411081345.3555853-1-sunil.khatri@amd.com>
Ignore. Added in the series.
On 11-04-2026 01:43 pm, Sunil Khatri wrote:
> Use pm_runtime_resume_and_get instead of pm_runtime_get_sync as it
> return error but put the reference in the function itself.
>
> In goto statements we need to drop the pm reference too.
>
> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index 0163fba4cf74..2981f4a3c457 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -738,10 +738,9 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
> if (r)
> return r;
>
> - r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
> + r = pm_runtime_resume_and_get(adev_to_drm(adev)->dev);
> if (r < 0) {
> - drm_file_err(uq_mgr->file, "pm_runtime_get_sync() failed for userqueue create\n");
> - pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
> + drm_file_err(uq_mgr->file, "pm_runtime_resume_and_get() failed for userqueue create\n");
> return r;
> }
>
> @@ -749,13 +748,15 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
> if (!uq_funcs) {
> drm_file_err(uq_mgr->file, "Usermode queue is not supported for this IP (%u)\n",
> args->in.ip_type);
> - return -EINVAL;
> + r = -EINVAL;
> + goto err_pm_runtime;
> }
>
> queue = kzalloc(sizeof(struct amdgpu_usermode_queue), GFP_KERNEL);
> if (!queue) {
> drm_file_err(uq_mgr->file, "Failed to allocate memory for queue\n");
> - return -ENOMEM;
> + r = -ENOMEM;
> + goto err_pm_runtime;
> }
>
> INIT_LIST_HEAD(&queue->userq_va_list);
> @@ -869,6 +870,8 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
> amdgpu_bo_unreserve(fpriv->vm.root.bo);
> free_queue:
> kfree(queue);
> +err_pm_runtime:
> + pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
> return r;
> }
>
prev parent reply other threads:[~2026-04-13 6:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-11 8:13 [PATCH] drm/amdgpu/userq: use pm_runtime_resume_and_get and fix err handling Sunil Khatri
2026-04-13 6:22 ` Khatri, Sunil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39bb946a-a327-4e75-8900-883a4e37a9ae@amd.com \
--to=sukhatri@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=sunil.khatri@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox