Drivers that do not use the ctrl-framework use this function instead.

Default value cannot be changed, return EINVAL as soon as possible.

Cc: sta...@vger.kernel.org
Fixes: 6fa6f831f095 ("media: v4l2-ctrls: add core request support")
Signed-off-by: Ricardo Ribalda <riba...@chromium.org>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 528eb5f420f6..ccd21b4d9c72 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -929,6 +929,13 @@ static bool check_ext_ctrls(struct v4l2_ext_controls *c, 
unsigned long ioctl)
                        return false;
                break;
        case V4L2_CTRL_WHICH_DEF_VAL:
+               /* Default value cannot be changed */
+               if (ioctl == VIDIOC_S_EXT_CTRLS ||
+                   ioctl == VIDIOC_TRY_EXT_CTRLS) {
+                       c->error_idx = c->count;
+                       return false;
+               }
+               return true;
        case V4L2_CTRL_WHICH_CUR_VAL:
                return true;
        case V4L2_CTRL_WHICH_REQUEST_VAL:
-- 
2.31.0.rc2.261.g7f71774620-goog

Reply via email to