Commit 1284ed59 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: vb2: check that buf_out_validate is present

The buf_out_validate is required for output queues in combination
with requests. Check this.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 6b3e4c4c
...@@ -409,6 +409,15 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md ...@@ -409,6 +409,15 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md
*/ */
if (WARN_ON(!q->ops->buf_request_complete)) if (WARN_ON(!q->ops->buf_request_complete))
return -EINVAL; return -EINVAL;
/*
* Make sure this op is implemented by the driver for the output queue.
* It's easy to forget this callback, but is it important to correctly
* validate the 'field' value at QBUF time.
*/
if (WARN_ON((q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT ||
q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) &&
!q->ops->buf_out_validate))
return -EINVAL;
if (vb->state != VB2_BUF_STATE_DEQUEUED) { if (vb->state != VB2_BUF_STATE_DEQUEUED) {
dprintk(1, "%s: buffer is not in dequeued state\n", opname); dprintk(1, "%s: buffer is not in dequeued state\n", opname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment