vb2: call __buf_finish_memory for prepared/queued buffers
PATCH 1/1 vb2: call __buf_finish_memory for prepared/queued buffers
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 <[email protected]>
--- drivers/media/v4l2-core/videobuf2-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/v4l2-core/videobuf2-core.c +3 -0
@@ -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); }
Signature · 1 line
1.9.0