diff options
-rw-r--r-- | drivers/media/video/v4l2-ctrls.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index d9e04394c856..0b1b30fded60 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -1826,9 +1826,6 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val) int ret; int i; - if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) - return -EACCES; - v4l2_ctrl_lock(ctrl); /* Reset the 'is_new' flags of the cluster */ @@ -1853,6 +1850,9 @@ int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *control) if (ctrl == NULL || !type_is_int(ctrl)) return -EINVAL; + if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) + return -EACCES; + return set_ctrl(ctrl, &control->value); } EXPORT_SYMBOL(v4l2_s_ctrl); |