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

Commit 48d829da authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] vivi: correctly cleanup after a start_streaming failure



If start_streaming fails then any queued buffers must be given back
to the vb2 core.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 9cf3c31a
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -889,10 +889,20 @@ static void buffer_queue(struct vb2_buffer *vb)
static int start_streaming(struct vb2_queue *vq, unsigned int count)
{
	struct vivi_dev *dev = vb2_get_drv_priv(vq);
	int err;

	dprintk(dev, 1, "%s\n", __func__);
	dev->seq_count = 0;
	return vivi_start_generating(dev);
	err = vivi_start_generating(dev);
	if (err) {
		struct vivi_buffer *buf, *tmp;

		list_for_each_entry_safe(buf, tmp, &dev->vidq.active, list) {
			list_del(&buf->list);
			vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
		}
	}
	return err;
}

/* abort streaming and wait for last buffer */