* [PATCH] usb: gadget: uvc: fix interval_duration calculation
@ 2026-03-06 3:30 Junzhong Pan
2026-03-06 9:58 ` Xu Yang
0 siblings, 1 reply; 2+ messages in thread
From: Junzhong Pan @ 2026-03-06 3:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Frank Li, Xu Yang
Cc: linux-usb, linux-kernel, stable, Junzhong Pan
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@vger.kernel.org
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
drivers/usb/gadget/function/uvc_video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index 7cea641b06b4..2f9700b3f1b6 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -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
---
base-commit: 5ee8dbf54602dc340d6235b1d6aa17c0f283f48c
change-id: 20260306-fix-uvc-interval-0dc36dbde48e
Best regards,
--
Junzhong Pan <panjunzhong@linux.spacemit.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: gadget: uvc: fix interval_duration calculation
2026-03-06 3:30 [PATCH] usb: gadget: uvc: fix interval_duration calculation Junzhong Pan
@ 2026-03-06 9:58 ` Xu Yang
0 siblings, 0 replies; 2+ messages in thread
From: Xu Yang @ 2026-03-06 9:58 UTC (permalink / raw)
To: Junzhong Pan
Cc: Greg Kroah-Hartman, Frank Li, linux-usb, linux-kernel, stable
On Fri, Mar 06, 2026 at 11:30:09AM +0800, Junzhong Pan wrote:
> 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@vger.kernel.org
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Thanks,
Xu Yang
> ---
> drivers/usb/gadget/function/uvc_video.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
> index 7cea641b06b4..2f9700b3f1b6 100644
> --- a/drivers/usb/gadget/function/uvc_video.c
> +++ b/drivers/usb/gadget/function/uvc_video.c
> @@ -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
>
> ---
> base-commit: 5ee8dbf54602dc340d6235b1d6aa17c0f283f48c
> change-id: 20260306-fix-uvc-interval-0dc36dbde48e
>
> Best regards,
> --
> Junzhong Pan <panjunzhong@linux.spacemit.com>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-06 10:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 3:30 [PATCH] usb: gadget: uvc: fix interval_duration calculation Junzhong Pan
2026-03-06 9:58 ` Xu Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox