public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: videobuf2: always set buffer vb2 pointer
@ 2021-09-28  3:46 Sergey Senozhatsky
  2021-09-28  6:24 ` Chen-Yu Tsai
  2021-10-05  9:57 ` Tomasz Figa
  0 siblings, 2 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2021-09-28  3:46 UTC (permalink / raw)
  To: Tomasz Figa, Hans Verkuil
  Cc: Marek Szyprowski, Mauro Carvalho Chehab, Ricardo Ribalda,
	linux-media, linux-kernel, Sergey Senozhatsky

We need to always link allocated vb2_dc_buf back to vb2_buffer because
we dereference vb2 in prepare() and finish() callbacks.

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 drivers/media/common/videobuf2/videobuf2-dma-contig.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index b052a4e36961..38767791955d 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -600,6 +600,7 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev,
 
 	buf->dev = dev;
 	buf->dma_dir = vb->vb2_queue->dma_dir;
+	buf->vb = vb;
 
 	offset = lower_32_bits(offset_in_page(vaddr));
 	vec = vb2_create_framevec(vaddr, size);
@@ -788,6 +789,8 @@ static void *vb2_dc_attach_dmabuf(struct vb2_buffer *vb, struct device *dev,
 		return ERR_PTR(-ENOMEM);
 
 	buf->dev = dev;
+	buf->vb = vb;
+
 	/* create attachment for the dmabuf with the user device */
 	dba = dma_buf_attach(dbuf, buf->dev);
 	if (IS_ERR(dba)) {
-- 
2.33.0.685.g46640cef36-goog


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

end of thread, other threads:[~2021-10-12  7:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28  3:46 [PATCH] media: videobuf2: always set buffer vb2 pointer Sergey Senozhatsky
2021-09-28  6:24 ` Chen-Yu Tsai
2021-09-28  7:53   ` Chen-Yu Tsai
2021-10-05  9:57 ` Tomasz Figa
2021-10-12  1:57   ` Sergey Senozhatsky
2021-10-12  7:52     ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox