]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: gadget: uvc: fix interval_duration calculation
authorJunzhong Pan <panjunzhong@linux.spacemit.com>
Fri, 6 Mar 2026 03:30:09 +0000 (11:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2026 15:19:04 +0000 (16:19 +0100)
To correctly convert bInterval as interval_duration:
  interval_duration = 2^(bInterval-1) * frame_interval

Current code uses a wrong left shift operand, computing 2^bInterval
instead of 2^(bInterval-1).

Fixes: 010dc57cb516 ("usb: gadget: uvc: fix interval_duration calculation")
Cc: stable <stable@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://patch.msgid.link/20260306-fix-uvc-interval-v1-1-9a2df6859859@linux.spacemit.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/uvc_video.c

index 7cea641b06b415102f13b101d1c935082e907a45..2f9700b3f1b64fd2acb4c6c93133793c6c531cb3 100644 (file)
@@ -513,7 +513,7 @@ uvc_video_prep_requests(struct uvc_video *video)
                return;
        }
 
-       interval_duration = 2 << (video->ep->desc->bInterval - 1);
+       interval_duration = 1 << (video->ep->desc->bInterval - 1);
        if (cdev->gadget->speed < USB_SPEED_HIGH)
                interval_duration *= 10000;
        else