From 4baa0dcac7371fbefbf2d86403d4c1ff8cdf5650 Mon Sep 17 00:00:00 2001 From: Sunil Khatri <sunil.khatri@amd.com> Date: Tue, 4 Mar 2025 23:18:29 +0530 Subject: [PATCH] drm/amdgpu: validate return value of pm_runtime_get_sync 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@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> --- 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 3a71d01b54c92..35ae4125cd833 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) { + dev_err(adev->dev, "pm_runtime_get_sync() failed for userqueue mqd create\n"); + 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) { -- GitLab