* [PATCH] drm/amdgpu/userq: use pm_runtime_resume_and_get and fix err handling
@ 2026-04-11 8:13 Sunil Khatri
2026-04-13 6:22 ` Khatri, Sunil
0 siblings, 1 reply; 2+ messages in thread
From: Sunil Khatri @ 2026-04-11 8:13 UTC (permalink / raw)
To: Alex Deucher, Christian König; +Cc: amd-gfx, Sunil Khatri
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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/amdgpu/userq: use pm_runtime_resume_and_get and fix err handling
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
0 siblings, 0 replies; 2+ messages in thread
From: Khatri, Sunil @ 2026-04-13 6:22 UTC (permalink / raw)
To: Sunil Khatri, Alex Deucher, Christian König; +Cc: amd-gfx
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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-13 6:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox