Mutex fence_drv_lock is cleanup in amdgpu_userq_fence_driver_free
but current cleanup is directly done later in the code which eventually
tried to do mutex_destroy two times.

Signed-off-by: Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 4a50f6536f8d..d3971bf9112b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -777,14 +777,16 @@ amdgpu_userq_create(struct drm_file *filp, union 
drm_amdgpu_userq *args)
        }
 
        queue->doorbell_index = index;
-       mutex_init(&queue->fence_drv_lock);
-       xa_init_flags(&queue->fence_drv_xa, XA_FLAGS_ALLOC);
+
        r = amdgpu_userq_fence_driver_alloc(adev, &queue->fence_drv);
        if (r) {
                drm_file_err(uq_mgr->file, "Failed to alloc fence driver\n");
                goto clean_doorbell;
        }
 
+       mutex_init(&queue->fence_drv_lock);
+       xa_init_flags(&queue->fence_drv_xa, XA_FLAGS_ALLOC);
+
        r = uq_funcs->mqd_create(queue, &args->in);
        if (r) {
                drm_file_err(uq_mgr->file, "Failed to create Queue\n");
@@ -860,7 +862,6 @@ amdgpu_userq_create(struct drm_file *filp, union 
drm_amdgpu_userq *args)
        amdgpu_bo_reserve(fpriv->vm.root.bo, true);
        amdgpu_userq_buffer_vas_list_cleanup(adev, queue);
        amdgpu_bo_unreserve(fpriv->vm.root.bo);
-       mutex_destroy(&queue->fence_drv_lock);
 free_queue:
        kfree(queue);
 err_pm_runtime:
-- 
2.34.1

Reply via email to