summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-02-21 09:34:49 +0100
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-11 10:56:44 +0100
commit48d829dadb80a2570aaa99fa324da41b3e05f43b (patch)
tree4a9f3c3cd0498a87a94a9ea1d3d74989bcdd3302 /drivers/media/platform
parent[media] vb2: call buf_finish after the state check (diff)
downloadlinux-48d829dadb80a2570aaa99fa324da41b3e05f43b.tar.xz
linux-48d829dadb80a2570aaa99fa324da41b3e05f43b.zip
[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: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/vivi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c
index 776015bc187d..cfe7548c4493 100644
--- a/drivers/media/platform/vivi.c
+++ b/drivers/media/platform/vivi.c
@@ -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 */