diff mbox series

drm/xe: unlock on error path in xe_vm_add_compute_exec_queue()

Message ID fa88d289-9886-474d-b697-b69881b4ddbe@moroto.mountain (mailing list archive)
State New, archived
Headers show
Series drm/xe: unlock on error path in xe_vm_add_compute_exec_queue() | expand

Commit Message

Dan Carpenter Jan. 5, 2024, 12:20 p.m. UTC
Drop the "&vm->lock" before returning.

Fixes: 24f947d58fe5 ("drm/xe: Use DRM GPUVM helpers for external- and evicted objects")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/xe/xe_vm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Matthew Brost Jan. 5, 2024, 8:36 p.m. UTC | #1
On Fri, Jan 05, 2024 at 03:20:22PM +0300, Dan Carpenter wrote:
> Drop the "&vm->lock" before returning.
> 
> Fixes: 24f947d58fe5 ("drm/xe: Use DRM GPUVM helpers for external- and evicted objects")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_vm.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 9180f2d2d71d..4aa7979fe6bf 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -332,13 +332,13 @@ int xe_vm_add_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
>  	down_write(&vm->lock);
>  	err = drm_gpuvm_exec_lock(&vm_exec);
>  	if (err)
> -		return err;
> +		goto out_up_write;
>  
>  	pfence = xe_preempt_fence_create(q, q->compute.context,
>  					 ++q->compute.seqno);
>  	if (!pfence) {
>  		err = -ENOMEM;
> -		goto out_unlock;
> +		goto out_fini;
>  	}
>  
>  	list_add(&q->compute.link, &vm->preempt.exec_queues);
> @@ -361,8 +361,9 @@ int xe_vm_add_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
>  
>  	up_read(&vm->userptr.notifier_lock);
>  
> -out_unlock:
> +out_fini:
>  	drm_exec_fini(exec);
> +out_up_write:
>  	up_write(&vm->lock);
>  
>  	return err;
> -- 
> 2.42.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 9180f2d2d71d..4aa7979fe6bf 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -332,13 +332,13 @@  int xe_vm_add_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
 	down_write(&vm->lock);
 	err = drm_gpuvm_exec_lock(&vm_exec);
 	if (err)
-		return err;
+		goto out_up_write;
 
 	pfence = xe_preempt_fence_create(q, q->compute.context,
 					 ++q->compute.seqno);
 	if (!pfence) {
 		err = -ENOMEM;
-		goto out_unlock;
+		goto out_fini;
 	}
 
 	list_add(&q->compute.link, &vm->preempt.exec_queues);
@@ -361,8 +361,9 @@  int xe_vm_add_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
 
 	up_read(&vm->userptr.notifier_lock);
 
-out_unlock:
+out_fini:
 	drm_exec_fini(exec);
+out_up_write:
 	up_write(&vm->lock);
 
 	return err;