All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Jan Kotas <jank@cadence.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: [PATCH] v4l2-dev: fix WARN_ON(!vdev->device_caps)
Date: Thu, 25 Jul 2019 14:48:21 +0200	[thread overview]
Message-ID: <b424ab15-986f-ec8c-183e-a26101dc97a8@xs4all.nl> (raw)

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 <hverkuil-cisco@xs4all.nl>
Fixes: 3c1350501c21 ("media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results")
Reported-by: Jan Kotas <jank@cadence.com>
---
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 */


                 reply	other threads:[~2019-07-25 12:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b424ab15-986f-ec8c-183e-a26101dc97a8@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=jank@cadence.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.