[PATCH] drm/xe: unlock object in an error condition

Oak Zeng oak.zeng at intel.com
Thu Nov 28 21:34:08 UTC 2024


In xe_gem_fault, we reserved a buffer object but didn't unreserve
it under an error condition. Unreserve it.

Signed-off-by: Oak Zeng <oak.zeng at intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index f51d86511cb9e..634a1b54ca60d 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1286,7 +1286,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
 	}
 
 	if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
-		goto out;
+		goto unlock;
 	/*
 	 * ttm_bo_vm_reserve() already has dma_resv_lock.
 	 */
@@ -1297,6 +1297,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf)
 		mutex_unlock(&xe->mem_access.vram_userfault.lock);
 	}
 
+unlock:
 	dma_resv_unlock(tbo->base.resv);
 out:
 	if (needs_rpm)
-- 
2.26.3



More information about the Intel-xe mailing list