]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: uvcvideo: uvc_ioctl_(g|s)_ext_ctrls: handle NoP case
authorRicardo Ribalda <ribalda@chromium.org>
Mon, 3 Feb 2025 11:55:43 +0000 (11:55 +0000)
committerHans Verkuil <hverkuil@xs4all.nl>
Mon, 3 Mar 2025 17:23:35 +0000 (18:23 +0100)
If nothing needs to be done. Exit early.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-7-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/usb/uvc/uvc_v4l2.c

index 9493ab375f07887cceca00c2f939f3835e003f50..4025811fb9e7880c44a8b1c0d4d1602ae68ec5ff 100644 (file)
@@ -1030,6 +1030,9 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
        u32 which;
        int ret;
 
+       if (!ctrls->count)
+               return 0;
+
        switch (ctrls->which) {
        case V4L2_CTRL_WHICH_DEF_VAL:
        case V4L2_CTRL_WHICH_CUR_VAL:
@@ -1070,6 +1073,9 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
        unsigned int i;
        int ret;
 
+       if (!ctrls->count)
+               return 0;
+
        ret = uvc_ctrl_check_access(chain, ctrls, ioctl);
        if (ret < 0)
                return ret;