Skip to contentSkip to conversation

drm/amdgpu: test uq_mgr list before add it to userq_mgr_list

PATCH New Prike Liang 1 participant 1 message Mar 25, 2025

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

PATCH 1/1 drm/amdgpu: test uq_mgr list before add it to userq_mgr_list

This test will avoid to add the uq_mgr duplicated list to the userq_mgr_list.

Fixes 4ed9e48f0821 ("drm/amdgpu: store userq_managers in a list in adev")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c +2 -1
index b661b0474409..5d533d66de85 100644
@@ -366,7 +366,8 @@ amdgpu_userqueue_create(struct drm_file *filp, union drm_amdgpu_userq *args)
 	}
 	args->out.queue_id = qid;
 	mutex_lock(&adev->userq_mutex);
-	list_add(&uq_mgr->list, &adev->userq_mgr_list);
+	if (list_empty(&uq_mgr->list))
+		list_add(&uq_mgr->list, &adev->userq_mgr_list);
 	mutex_unlock(&adev->userq_mutex);
 
 unlock:
Signature · 1 line
2.34.1