aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2014-12-07 11:59:42 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-16 23:21:39 -0200
commit454a4e728dd56c8515b80381c14168099279e7fc (patch)
tree45f99d5b5726ed8f68b3e4554255714ff8e3abac /drivers/media
parent[media] vivid: fix CROP_BOUNDS typo for video output (diff)
downloadlinux-dev-454a4e728dd56c8515b80381c14168099279e7fc.tar.xz
linux-dev-454a4e728dd56c8515b80381c14168099279e7fc.zip
[media] v4l2-ioctl: WARN_ON if querycap didn't fill device_caps
This is easy to forget to do in drivers. While v4l2-compliance will check for it, not everyone remembers to run it. So warn about it. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/v4l2-core/v4l2-ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 75658717961f..faac2f4e0f3a 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1017,6 +1017,12 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
ret = ops->vidioc_querycap(file, fh, cap);
cap->capabilities |= V4L2_CAP_EXT_PIX_FORMAT;
+ /*
+ * Drivers MUST fill in device_caps, so check for this and
+ * warn if it was forgotten.
+ */
+ WARN_ON(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
+ !cap->device_caps);
cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;
return ret;