usb: xhci-mtk: fix the failure of bandwidth allocation
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Fri, 10 Jul 2020 05:57:52 +0000 (13:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2020 12:05:49 +0000 (14:05 +0200)
The wMaxPacketSize field of endpoint descriptor may be zero
as default value in alternate interface, and they are not
actually selected when start stream, so skip them when try to
allocate bandwidth.

Cc: stable <stable@vger.kernel.org>
Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1594360672-2076-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mtk-sch.c

index fea5555..45c54d5 100644 (file)
@@ -557,6 +557,10 @@ static bool need_bw_sch(struct usb_host_endpoint *ep,
        if (is_fs_or_ls(speed) && !has_tt)
                return false;
 
+       /* skip endpoint with zero maxpkt */
+       if (usb_endpoint_maxp(&ep->desc) == 0)
+               return false;
+
        return true;
 }