On 3/12/26 14:44, Srinivasan Shanmugam wrote:
> amdgpu_dma_buf_attach() locks bo->tbo.base.resv before updating the BO
> sharing state and unlocks it before returning.
> 
> Return the local status variable after the unlock so the function has a
> single consistent success return path, which avoids the Smatch warning
> about inconsistent reservation lock handling.

Mhm, that doesn't looks correct to me.

> 
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:111 amdgpu_dma_buf_attach() warn: 
> inconsistent returns 'bo->tbo.base.resv'.

As far as I can see neither that warning nor the fact that returning the error 
(which is always 0 at that point) would fix it makes sense to me.

What exactly is going on here?

Regards,
Christian.

> 
> Fixes: 6e6db2722c28 ("drm/amdgpu: add independent DMA-buf export v8")
> Cc: Dan Carpenter <[email protected]>
> Cc: Alex Deucher <[email protected]>
> Cc: Christian König <[email protected]>
> Signed-off-by: Srinivasan Shanmugam <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> index 656c267dbe58..9cf240ad5471 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> @@ -108,7 +108,7 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
>  
>       dma_resv_unlock(bo->tbo.base.resv);
>  
> -     return 0;
> +     return r;
>  }
>  
>  /**

Reply via email to