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

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5689
Fixes: 8bb31587820a ("drm/ttm: remove bo->moving")
Cc: Christian König <[email protected]>
Cc: Daniel Vetter <[email protected]>
Signed-off-by: Matthew Auld <[email protected]>
Reviewed-by: Christian König <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 015a94f766de..f7fbf162ce41 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -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;
 }
 
 /*
-- 
2.34.1

Reply via email to