Skip to contentSkip to conversation

vb2: call __buf_finish_memory for prepared/queued buffers

PATCH Superseded Hans Verkuil 1 participant 1 message Mar 28, 2014 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/media/v4l2-core/videobuf2-core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/v4l2-core/videobuf2-core.c +3 -0
index 0bd0fd4..8f0624b 100644
@@ -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