On 4/8/26 11:38, Sunil Khatri wrote:
> If the queue creation failed during mapping of the important VA's
> like queue_va, rptr_va and wptr_va. These needs to be cleaned
> as queue destroy will not be called for such queues as user never
> get call to creation failure.
> 
> Signed-off-by: Sunil Khatri <[email protected]>

Acked-by: Christian König <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index c19d993fe8c3..ae973c611972 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -767,7 +767,7 @@ amdgpu_userq_create(struct drm_file *filp, union 
> drm_amdgpu_userq *args)
>           amdgpu_userq_input_va_validate(adev, queue, args->in.rptr_va, 
> AMDGPU_GPU_PAGE_SIZE) ||
>           amdgpu_userq_input_va_validate(adev, queue, args->in.wptr_va, 
> AMDGPU_GPU_PAGE_SIZE)) {
>               r = -EINVAL;
> -             goto free_queue;
> +             goto clean_mapping;
>       }
>  
>       /* Convert relative doorbell offset into absolute doorbell index */
> @@ -775,7 +775,7 @@ amdgpu_userq_create(struct drm_file *filp, union 
> drm_amdgpu_userq *args)
>       if (index == (uint64_t)-EINVAL) {
>               drm_file_err(uq_mgr->file, "Failed to get doorbell for 
> queue\n");
>               r = -EINVAL;
> -             goto free_queue;
> +             goto clean_mapping;
>       }
>  
>       queue->doorbell_index = index;
> @@ -783,7 +783,7 @@ amdgpu_userq_create(struct drm_file *filp, union 
> drm_amdgpu_userq *args)
>       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 free_queue;
> +             goto clean_mapping;
>       }
>  
>       /*
> @@ -857,7 +857,8 @@ amdgpu_userq_create(struct drm_file *filp, union 
> drm_amdgpu_userq *args)
>  clean_fence_driver:
>       amdgpu_userq_fence_driver_free(queue);
>       mutex_unlock(&uq_mgr->userq_mutex);
> -free_queue:
> +clean_mapping:
> +     amdgpu_userq_buffer_vas_list_cleanup(adev, queue);
>       kfree(queue);
>       return r;
>  }

Reply via email to