Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f0e5fd3 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: vb2: add a new warning about pending buffers



There's a logic at the VB2 core that produces a WARN_ON if
there are still buffers waiting to be filled. However, it doesn't
indicate what buffers are still opened, with makes harder to
identify issues inside caller drivers.

So, add a new pr_warn() pointing to such buffers. That, together
with debug instrumentation inside the drivers can make easier to
identify where the problem is.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 2e33dbb0
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -1658,8 +1658,11 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
	 */
	 */
	if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
	if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
		for (i = 0; i < q->num_buffers; ++i)
		for (i = 0; i < q->num_buffers; ++i)
			if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE)
			if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) {
				pr_warn("driver bug: stop_streaming operation is leaving buf %p in active state\n",
					q->bufs[i]);
				vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR);
				vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR);
			}
		/* Must be zero now */
		/* Must be zero now */
		WARN_ON(atomic_read(&q->owned_by_drv_count));
		WARN_ON(atomic_read(&q->owned_by_drv_count));
	}
	}