diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-02-21 03:34:49 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-11 05:56:44 -0400 |
commit | 48d829dadb80a2570aaa99fa324da41b3e05f43b (patch) | |
tree | 4a9f3c3cd0498a87a94a9ea1d3d74989bcdd3302 | |
parent | 9cf3c31a8b63f56066de73695e256b7da96fff1e (diff) |
[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>
-rw-r--r-- | drivers/media/platform/vivi.c | 12 |
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) | |||
889 | static int start_streaming(struct vb2_queue *vq, unsigned int count) | 889 | static int start_streaming(struct vb2_queue *vq, unsigned int count) |
890 | { | 890 | { |
891 | struct vivi_dev *dev = vb2_get_drv_priv(vq); | 891 | struct vivi_dev *dev = vb2_get_drv_priv(vq); |
892 | int err; | ||
892 | 893 | ||
893 | dprintk(dev, 1, "%s\n", __func__); | 894 | dprintk(dev, 1, "%s\n", __func__); |
894 | dev->seq_count = 0; | 895 | dev->seq_count = 0; |
895 | return vivi_start_generating(dev); | 896 | err = vivi_start_generating(dev); |
897 | if (err) { | ||
898 | struct vivi_buffer *buf, *tmp; | ||
899 | |||
900 | list_for_each_entry_safe(buf, tmp, &dev->vidq.active, list) { | ||
901 | list_del(&buf->list); | ||
902 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); | ||
903 | } | ||
904 | } | ||
905 | return err; | ||
896 | } | 906 | } |
897 | 907 | ||
898 | /* abort streaming and wait for last buffer */ | 908 | /* abort streaming and wait for last buffer */ |