Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
[firefly-linux-kernel-4.4.55.git] / drivers / media / v4l2-core / v4l2-ioctl.c
index 75658717961f4ac6603890ab785d444cfe864c3d..faac2f4e0f3ad358699a55123ebe18b38e8f65f5 100644 (file)
@@ -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;