Skip to contentSkip to conversation

drm/ttm: fixup ttm_bo_add_move_fence

PATCH In review Matthew Auld 2 participants 2 messages Apr 13, 2022

Subsystems (3)
lore
Share & tools
lore

Matthew Auld

author reviewer
#0 lore raw

PATCH v2 1/1 drm/ttm: fixup ttm_bo_add_move_fence

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

v2(Daniel):
- Simplify the function tail

Fixes 8bb31587820a ("drm/ttm: remove bo->moving")
Cc Christian König <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -5
index 015a94f766de..f7fbf162ce41 100644
@@ -740,11 +740,9 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
 	dma_resv_add_fence(bo->base.resv, fence, DMA_RESV_USAGE_KERNEL);
 
 	ret = dma_resv_reserve_fences(bo->base.resv, 1);
-	if (unlikely(ret)) {
-		dma_fence_put(fence);
-		return ret;
-	}
-	return 0;
+
+	dma_fence_put(fence);
+	return ret;
 }
 
 /*
Signature · 1 line
2.34.1
#1 lore raw

Am 13.04.22 um 10:51 schrieb Matthew Auld:

Quoted 6 lines

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

v2(Daniel):
- Simplify the function tail

Quoted 7 lines

I've just pushed this version here to drm-misc-next.

Thanks,
Christian.

Quoted 23 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -5
index 015a94f766de..f7fbf162ce41 100644
@@ -740,11 +740,9 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
  	dma_resv_add_fence(bo->base.resv, fence, DMA_RESV_USAGE_KERNEL);
 
  	ret = dma_resv_reserve_fences(bo->base.resv, 1);
-	if (unlikely(ret)) {
-		dma_fence_put(fence);
-		return ret;
-	}
-	return 0;
+
+	dma_fence_put(fence);
+	return ret;
  }
 
  /*