mirror of https://github.com/torvalds/linux.git
drm/amdgpu/userq: properly clean up userq fence driver on failure
If userq creation fails, we need to properly unwind and free the user queue fence driver. v2: free idr as well (Sunil) Reviewed-by: Sunil Khatri <sunil.khatri@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
edc762a51c
commit
c0bbf64870
|
|
@ -330,6 +330,7 @@ amdgpu_userqueue_create(struct drm_file *filp, union drm_amdgpu_userq *args)
|
|||
r = uq_funcs->mqd_create(uq_mgr, &args->in, queue);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to create Queue\n");
|
||||
amdgpu_userq_fence_driver_free(queue);
|
||||
kfree(queue);
|
||||
goto unlock;
|
||||
}
|
||||
|
|
@ -337,6 +338,7 @@ amdgpu_userqueue_create(struct drm_file *filp, union drm_amdgpu_userq *args)
|
|||
qid = idr_alloc(&uq_mgr->userq_idr, queue, 1, AMDGPU_MAX_USERQ_COUNT, GFP_KERNEL);
|
||||
if (qid < 0) {
|
||||
DRM_ERROR("Failed to allocate a queue id\n");
|
||||
amdgpu_userq_fence_driver_free(queue);
|
||||
uq_funcs->mqd_destroy(uq_mgr, queue);
|
||||
kfree(queue);
|
||||
r = -ENOMEM;
|
||||
|
|
@ -346,6 +348,8 @@ amdgpu_userqueue_create(struct drm_file *filp, union drm_amdgpu_userq *args)
|
|||
r = uq_funcs->map(uq_mgr, queue);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to map Queue\n");
|
||||
idr_remove(&uq_mgr->userq_idr, qid);
|
||||
amdgpu_userq_fence_driver_free(queue);
|
||||
uq_funcs->mqd_destroy(uq_mgr, queue);
|
||||
kfree(queue);
|
||||
goto unlock;
|
||||
|
|
|
|||
Loading…
Reference in New Issue