All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Make amdgpu_dma_buf_attach() return paths consistent
@ 2026-03-12 13:44 Srinivasan Shanmugam
  2026-03-12 14:03 ` Christian König
  2026-03-12 15:08 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Srinivasan Shanmugam @ 2026-03-12 13:44 UTC (permalink / raw)
  To: Christian König, Alex Deucher
  Cc: amd-gfx, Srinivasan Shanmugam, Dan Carpenter

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.

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

Fixes: 6e6db2722c28 ("drm/amdgpu: add independent DMA-buf export v8")
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
---
 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;
 }
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-13  8:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 13:44 [PATCH] drm/amdgpu: Make amdgpu_dma_buf_attach() return paths consistent Srinivasan Shanmugam
2026-03-12 14:03 ` Christian König
2026-03-12 14:23   ` SHANMUGAM, SRINIVASAN
2026-03-12 15:08 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.