From 049e684f2de9daa31a32423e16d2d3bd6bbd286f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 25 Jul 2019 08:48:21 -0400 Subject: [PATCH] media: v4l2-dev: fix WARN_ON(!vdev->device_caps) Device nodes of type VFL_TYPE_SUBDEV have a 0 device_caps, so they trigger this warning. Add a check against VFL_TYPE_SUBDEV. Signed-off-by: Hans Verkuil Fixes: 3c1350501c21 ("media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results") Reported-by: Jan Kotas Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 3af72e3bbd65..a1c61d6f3b9b 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -859,8 +859,8 @@ int __video_register_device(struct video_device *vdev, /* the v4l2_dev pointer MUST be present */ if (WARN_ON(!vdev->v4l2_dev)) return -EINVAL; - /* the device_caps field MUST be set */ - if (WARN_ON(!vdev->device_caps)) + /* the device_caps field MUST be set for all but subdevs */ + if (WARN_ON(type != VFL_TYPE_SUBDEV && !vdev->device_caps)) return -EINVAL; /* v4l2_fh support */