Skip to contentSkip to conversation

v4l2-subdev: Try formats are only available if subdev API is enabled

PATCH Superseded Sakari Ailus 1 participant 1 message May 31, 2019 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v4l2-subdev: Try formats are only available if subdev API is enabled

Return an error for which == V4L2_SUBDEV_FORMAT_TRY if CONFIG_VIDEO_V4L2_SUBDEV_API is not enabled. This is because the try formats are not available in that case. Do the check here so that drivers don't need to.

Depends-on: ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument")

---
 drivers/media/v4l2-core/v4l2-subdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-subdev.c +4 -1
index 34219e489be27..88b4b9d7c41be 100644
@@ -122,7 +122,10 @@ static int subdev_close(struct file *file)
 
 static inline int check_which(__u32 which)
 {
-	if (which != V4L2_SUBDEV_FORMAT_TRY &&
+	if (
+#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
+	    which != V4L2_SUBDEV_FORMAT_TRY &&
+#endif
 	    which != V4L2_SUBDEV_FORMAT_ACTIVE)
 		return -EINVAL;
 
Signature · 1 line
2.11.0