Skip to content

Commit 7e008b0

Browse files
dma-buf: fix unintended pin/unpin warnings
DMA-buf internal users call the pin/unpin functions without having a dynamic attachment. Avoid the warning and backtrace in the logs. Signed-off-by: Christian König <[email protected]> Bugs: https://gitlab.freedesktop.org/drm/intel/-/issues/3481 Fixes: c545781 ("dma-buf: doc polish for pin/unpin") Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> CC: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c55b44c commit 7e008b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev,
760760

761761
if (dma_buf_is_dynamic(attach->dmabuf)) {
762762
dma_resv_lock(attach->dmabuf->resv, NULL);
763-
ret = dma_buf_pin(attach);
763+
ret = dmabuf->ops->pin(attach);
764764
if (ret)
765765
goto err_unlock;
766766
}
@@ -786,7 +786,7 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev,
786786

787787
err_unpin:
788788
if (dma_buf_is_dynamic(attach->dmabuf))
789-
dma_buf_unpin(attach);
789+
dmabuf->ops->unpin(attach);
790790

791791
err_unlock:
792792
if (dma_buf_is_dynamic(attach->dmabuf))
@@ -843,7 +843,7 @@ void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach)
843843
__unmap_dma_buf(attach, attach->sgt, attach->dir);
844844

845845
if (dma_buf_is_dynamic(attach->dmabuf)) {
846-
dma_buf_unpin(attach);
846+
dmabuf->ops->unpin(attach);
847847
dma_resv_unlock(attach->dmabuf->resv);
848848
}
849849
}
@@ -956,7 +956,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
956956
if (dma_buf_is_dynamic(attach->dmabuf)) {
957957
dma_resv_assert_held(attach->dmabuf->resv);
958958
if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) {
959-
r = dma_buf_pin(attach);
959+
r = attach->dmabuf->ops->pin(attach);
960960
if (r)
961961
return ERR_PTR(r);
962962
}
@@ -968,7 +968,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
968968

969969
if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) &&
970970
!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
971-
dma_buf_unpin(attach);
971+
attach->dmabuf->ops->unpin(attach);
972972

973973
if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) {
974974
attach->sgt = sg_table;

0 commit comments

Comments
 (0)