提交 69b95a3a 编写于 作者: S Sylwester Nawrocki 提交者: Mauro Carvalho Chehab

[media] s3c-camif: Fail on insufficient number of allocated buffers

Ensure the driver gets always at least its minimum required
number of buffers allocated by checking actual number of
allocated buffers in vb2_reqbufs(). And free any partially
allocated buffer queue with signaling an error to user space.
Without this patch applications may wait forever to dequeue
a filled buffer, because the hardware didn't even start after
VIDIOC_STREAMON, VIDIOC_QBUF calls, due to insufficient number
of empty buffers.
Reported-by: NAlexander Nestorov <alexandernst@gmail.com>
Signed-off-by: NSylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 6aa69f99
......@@ -934,12 +934,19 @@ static int s3c_camif_reqbufs(struct file *file, void *priv,
vp->owner = NULL;
ret = vb2_reqbufs(&vp->vb_queue, rb);
if (!ret) {
vp->reqbufs_count = rb->count;
if (vp->owner == NULL && rb->count > 0)
vp->owner = priv;
if (ret < 0)
return ret;
if (rb->count && rb->count < CAMIF_REQ_BUFS_MIN) {
rb->count = 0;
vb2_reqbufs(&vp->vb_queue, rb);
ret = -ENOMEM;
}
vp->reqbufs_count = rb->count;
if (vp->owner == NULL && rb->count > 0)
vp->owner = priv;
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册