summaryrefslogtreecommitdiff
path: root/drivers/media/common/videobuf2
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-05-21 15:43:02 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-05-28 22:51:46 +0300
commit90b2da89a083e1395cb322521a42397c49ae4500 (patch)
tree97a2fbc817f87fb15a517292335a7a43395c4dd2 /drivers/media/common/videobuf2
parenta024ee14cd36dba55fd77322f5d48ee0e55418ae (diff)
downloadlinux-90b2da89a083e1395cb322521a42397c49ae4500.tar.xz
media: videobuf2-core: don't call memop 'finish' when queueing
When a buffer is queued or requeued in vb2_buffer_done, then don't call the finish memop. In this case the buffer is only returned to vb2, not to userspace. Calling 'finish' here will cause an unbalance when the queue is canceled, since the core will call the same memop again. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/common/videobuf2')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-core.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index d3f7bb33a54d..f32ec7342ef0 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -916,9 +916,12 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
dprintk(4, "done processing on buffer %d, state: %d\n",
vb->index, state);
- /* sync buffers */
- for (plane = 0; plane < vb->num_planes; ++plane)
- call_void_memop(vb, finish, vb->planes[plane].mem_priv);
+ if (state != VB2_BUF_STATE_QUEUED &&
+ state != VB2_BUF_STATE_REQUEUEING) {
+ /* sync buffers */
+ for (plane = 0; plane < vb->num_planes; ++plane)
+ call_void_memop(vb, finish, vb->planes[plane].mem_priv);
+ }
spin_lock_irqsave(&q->done_lock, flags);
if (state == VB2_BUF_STATE_QUEUED ||