v4l2-compliance reports unbalanced prepare/finish memops in the case
where buffers are queued, streamon is never called and then reqbufs()
is called that has to cancel any queued buffers.

When canceling a queue __buf_finish_memory() should be called for all
buffers in the state 'PREPARED' or 'QUEUED' to ensure the prepare and
finish memops are balanced.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
---
 drivers/media/v4l2-core/videobuf2-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 0bd0fd4..8f0624b 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -2135,6 +2135,9 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
                struct vb2_buffer *vb = q->bufs[i];
 
                if (vb->state != VB2_BUF_STATE_DEQUEUED) {
+                       if (vb->state == VB2_BUF_STATE_QUEUED ||
+                           vb->state == VB2_BUF_STATE_PREPARED)
+                               __buf_finish_memory(vb);
                        vb->state = VB2_BUF_STATE_PREPARED;
                        call_vb_qop(vb, buf_finish, vb);
                }
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to