aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-16 12:01:14 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-16 12:32:25 +0100
commitb0fc34721330f19a9e4017150a1f355f1bea59df (patch)
tree985e1cf2ef03940752ac8736249e05c4306b8d27
parent95060aeda4e74b5904b151dfef38cd68441d7aa1 (diff)
vb2: check that buf_out_validate is presentbr-buf-out-validate
The buf_out_validate is required for output queues in combination with requests. Check this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--drivers/media/common/videobuf2/videobuf2-v4l2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index 75ea90e795d8..653869031b71 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -409,6 +409,13 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md
*/
if (WARN_ON(!q->ops->buf_request_complete))
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->is_output && !q->ops->buf_out_validate))
+ return -EINVAL;
if (vb->state != VB2_BUF_STATE_DEQUEUED) {
dprintk(1, "%s: buffer is not in dequeued state\n", opname);

Privacy Policy