In case of failure in xa_alloc, remove the queue during
clean up from the userq_doorbell_xa.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 001fcfcbde0f..5224871a099c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -865,6 +865,7 @@ amdgpu_userq_create(struct drm_file *filp, union 
drm_amdgpu_userq *args)
        if (r) {
                drm_file_err(uq_mgr->file, "Failed to allocate a queue id\n");
                amdgpu_userq_fence_driver_free(queue);
+               xa_erase_irq(&adev->userq_doorbell_xa, index);
                uq_funcs->mqd_destroy(queue);
                kfree(queue);
                r = -ENOMEM;
-- 
2.34.1

Reply via email to