[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210928034634.333785-1-senozhatsky@chromium.org>
Date: Tue, 28 Sep 2021 12:46:34 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Tomasz Figa <tfiga@...omium.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Ricardo Ribalda <ribalda@...omium.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: [PATCH] media: videobuf2: always set buffer vb2 pointer
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@...omium.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
Powered by blists - more mailing lists