From: Pawel Osciak <[email protected]>

Streamon should return -EINVAL if called on an output device and no
buffers are queued.

Signed-off-by: Pawel Osciak <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Marek Szyprowski <[email protected]>
---
 drivers/media/video/videobuf-core.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/videobuf-core.c 
b/drivers/media/video/videobuf-core.c
index ce1595b..2cdf8ed 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -725,6 +725,17 @@ int videobuf_streamon(struct videobuf_queue *q)
        int retval;
 
        mutex_lock(&q->vb_lock);
+
+       if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT
+                       || q->type == V4L2_BUF_TYPE_VBI_OUTPUT
+                       || q->type == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
+               if (list_empty(&q->stream)) {
+                       dprintk(1, "streamon: no output buffers queued\n");
+                       retval = -EINVAL;
+                       goto done;
+               }
+       }
+
        retval = -EBUSY;
        if (q->reading)
                goto done;
-- 
1.7.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to