Skip to content

Commit

Permalink
usb: mtu3: fix the wrong HS mult value
Browse files Browse the repository at this point in the history
commit 44e4439 upstream.

usb_endpoint_maxp() returns actual max packet size, @mult will
always be zero, fix it by using usb_endpoint_maxp_mult() instead
to get mult.

Fixes: 4d79e04 ("usb: mtu3: add support for usb3.1 IP")
Cc: stable@vger.kernel.org
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1628836253-7432-3-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chunfeng Yun authored and gregkh committed Sep 12, 2021
1 parent aae2250 commit c5240f1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/usb/mtu3/mtu3_gadget.c
Expand Up @@ -64,14 +64,12 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
u32 interval = 0;
u32 mult = 0;
u32 burst = 0;
int max_packet;
int ret;

desc = mep->desc;
comp_desc = mep->comp_desc;
mep->type = usb_endpoint_type(desc);
max_packet = usb_endpoint_maxp(desc);
mep->maxp = max_packet & GENMASK(10, 0);
mep->maxp = usb_endpoint_maxp(desc);

switch (mtu->g.speed) {
case USB_SPEED_SUPER:
Expand All @@ -92,7 +90,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
usb_endpoint_xfer_int(desc)) {
interval = desc->bInterval;
interval = clamp_val(interval, 1, 16) - 1;
mult = (max_packet & GENMASK(12, 11)) >> 11;
mult = usb_endpoint_maxp_mult(desc) - 1;
}
break;
default:
Expand Down

0 comments on commit c5240f1

Please sign in to comment.