[PATCH 3/6] drm/ttm: fix error handling in ttm_buffer_object_transfer

Matthew Brost matthew.brost at intel.com
Tue Jun 24 02:24:39 UTC 2025


On Mon, Jun 16, 2025 at 03:07:23PM +0200, Christian König wrote:
> Unlocking the resv object was missing in the error path, additionally to
> that we should move over the resource only after the fence slot was
> reserved.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

Fixes tag?

You probably can merge this one by itself ahead of the rest of the series.

With that:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index b78365dc1fed..56f3152f34f5 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -256,6 +256,13 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
>  	ret = dma_resv_trylock(&fbo->base.base._resv);
>  	WARN_ON(!ret);
>  
> +	ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
> +	if (ret) {
> +		dma_resv_unlock(&fbo->base.base._resv);
> +		kfree(fbo);
> +		return ret;
> +	}
> +
>  	if (fbo->base.resource) {
>  		ttm_resource_set_bo(fbo->base.resource, &fbo->base);
>  		bo->resource = NULL;
> @@ -264,12 +271,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
>  		fbo->base.bulk_move = NULL;
>  	}
>  
> -	ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
> -	if (ret) {
> -		kfree(fbo);
> -		return ret;
> -	}
> -
>  	ttm_bo_get(bo);
>  	fbo->bo = bo;
>  
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list