From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
tomi.valkeinen@ideasonboard.com, bingbu.cao@intel.com,
hongju.wang@intel.com, hverkuil@xs4all.nl,
Andrey Konovalov <andrey.konovalov@linaro.org>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Dmitry Perchanov <dmitry.perchanov@intel.com>,
"Ng, Khai Wen" <khai.wen.ng@intel.com>,
Alain Volmat <alain.volmat@foss.st.com>
Subject: [PATCH v3 11/14] media: v4l: subdev: Copy argument back to user also for S_ROUTING
Date: Fri, 26 Apr 2024 11:50:35 +0300 [thread overview]
Message-ID: <20240426085038.943733-12-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20240426085038.943733-1-sakari.ailus@linux.intel.com>
As the user needs to know what went wrong for S_ROUTING, copy array
arguments back to the user.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 5e928e2a2beb..0260acef97d2 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -3461,11 +3461,14 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
* FIXME: subdev IOCTLS are partially handled here and partially in
* v4l2-subdev.c and the 'always_copy' flag can only be set for IOCTLS
* defined here as part of the 'v4l2_ioctls' array. As
- * VIDIOC_SUBDEV_G_ROUTING needs to return results to applications even
- * in case of failure, but it is not defined here as part of the
+ * VIDIOC_SUBDEV_[GS]_ROUTING needs to return results to applications
+ * even in case of failure, but it is not defined here as part of the
* 'v4l2_ioctls' array, insert an ad-hoc check to address that.
*/
- if (err < 0 && !always_copy && cmd != VIDIOC_SUBDEV_G_ROUTING)
+ if (cmd == VIDIOC_SUBDEV_G_ROUTING || cmd == VIDIOC_SUBDEV_S_ROUTING)
+ always_copy = true;
+
+ if (err < 0 && !always_copy)
goto out;
if (has_array_args) {
--
2.39.2
next prev parent reply other threads:[~2024-04-26 8:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 8:50 [PATCH v3 00/14] Generic line based metadata, without sensor API changes Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 01/14] media: v4l2-subdev: Clearly document that the crop API won't be extended Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 02/14] media: Documentation: Add "stream" into glossary Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 03/14] media: uapi: Add generic serial metadata mbus formats Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 04/14] media: uapi: Document which mbus format fields are valid for metadata Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 05/14] media: uapi: v4l: Add generic 8-bit metadata format definitions Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 06/14] media: v4l: Support line-based metadata capture Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 07/14] media: v4l: Set line based metadata flag in V4L2 core Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 08/14] media: Documentation: Additional streams generally don't harm capture Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 09/14] media: Documentation: Document S_ROUTING behaviour Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 10/14] media: v4l: subdev: Add a function to lock two sub-device states, use it Sakari Ailus
2024-04-26 8:50 ` Sakari Ailus [this message]
2024-04-26 8:50 ` [PATCH v3 12/14] media: v4l: subdev: Add len_routes field to struct v4l2_subdev_routing Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 13/14] media: v4l: subdev: Return routes set using S_ROUTING Sakari Ailus
2024-04-26 8:50 ` [PATCH v3 14/14] media: v4l: subdev: Add trivial set_routing support Sakari Ailus
2024-04-26 15:33 ` [PATCH] media: uapi: v4l: Don't expose generic metadata formats to userspace Laurent Pinchart
2024-04-29 7:05 ` Tomi Valkeinen
2024-04-29 8:33 ` Laurent Pinchart
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=20240426085038.943733-12-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=alain.volmat@foss.st.com \
--cc=andrey.konovalov@linaro.org \
--cc=bingbu.cao@intel.com \
--cc=dmitry.perchanov@intel.com \
--cc=hongju.wang@intel.com \
--cc=hverkuil@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=khai.wen.ng@intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=tomi.valkeinen@ideasonboard.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).