Skip to contentSkip to conversation

drm/amdgpu: correct the runtime deference for mes_userq_mqd_create()

PATCH In review Prike Liang 2 participants 2 messages Mar 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: correct the runtime deference for mes_userq_mqd_create()

When the runtime resume failed, then the runtime uage decreased at free_mqd. So the runtime resume error handler doesn't need to decrease the runtime usage separately.

Fixes 4baa0dcac737 ("drm/amdgpu: validate return value of pm_runtime_get_sync")
---
 drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +2 -2
index 35ae4125cd83..b469b800119f 100644
@@ -291,8 +291,7 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,
 	r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
 	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;
+		goto deference_pm;
 	}
 
 	r = mqd_hw_default->init_mqd(adev, (void *)queue->mqd.cpu_ptr, userq_props);
@@ -330,6 +329,7 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,
 free_mqd:
 	amdgpu_userqueue_destroy_object(uq_mgr, &queue->mqd);
 	pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
+deference_pm:
 	pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
 
 free_props:
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Prike Liang

When the runtime resume failed, then the runtime uage decreased at free_mqd. So the runtime resume error handler doesn't need to decrease the runtime usage separately.

Fixes 4baa0dcac737 ("drm/amdgpu: validate return value of pm_runtime_get_sync")
Quoted 29 lines
---
 drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +2 -3
index 35ae4125cd83..b469b800119f 100644
@@ -291,8 +291,7 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,
        r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
        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;
+               goto deference_pm;
        }
 
        r = mqd_hw_default->init_mqd(adev, (void *)queue->mqd.cpu_ptr, userq_props);
@@ -330,6 +329,7 @@ static int mes_userq_mqd_create(struct amdgpu_userq_mgr *uq_mgr,
 free_mqd:
        amdgpu_userqueue_destroy_object(uq_mgr, &queue->mqd);
        pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
+deference_pm:
        pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
 
 free_props:
--

2.34.1