diff mbox

[4/8] v4l: videobuf: Fail streamon on an output device when no buffers queued

Message ID 1283756030-28634-5-git-send-email-m.szyprowski@samsung.com (mailing list archive)
State RFC
Headers show

Commit Message

Marek Szyprowski Sept. 6, 2010, 6:53 a.m. UTC
None
diff mbox

Patch

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;