From patchwork Fri Jul 10 05:57:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11655739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5209739 for ; Fri, 10 Jul 2020 05:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7A9C20787 for ; Fri, 10 Jul 2020 05:59:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="QbSlvJqP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727007AbgGJF67 (ORCPT ); Fri, 10 Jul 2020 01:58:59 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:2731 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726288AbgGJF67 (ORCPT ); Fri, 10 Jul 2020 01:58:59 -0400 X-UUID: 608734bb72ea495f801e4bd979a00c26-20200710 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=NXSoc40w/vzs0ddT+Wgmf68IXPtgdbuXrs4l5A4rBb8=; b=QbSlvJqPSnMFhxDlQjAwuFfqCFVI8kw/C7eolqgnJz5u2aKy00V+DxPsVgxoWxdDdDoLi3iddwQt7gT09KYlLmZRn0W3Kcxkq69Zf5jpDlxhrofjBPuxqcggQy6vfLBc+hJ+wEu+6uqetrP7p/GYtuhk2NOeiG8jh1k0uXpWgHc=; X-UUID: 608734bb72ea495f801e4bd979a00c26-20200710 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 758997052; Fri, 10 Jul 2020 13:58:52 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 10 Jul 2020 13:58:48 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 10 Jul 2020 13:58:49 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Greg Kroah-Hartman , Matthias Brugger , , , , , Nicolas Boichat , Chunfeng Yun , stable Subject: [v2 PATCH] usb: xhci-mtk: fix the failure of bandwidth allocation Date: Fri, 10 Jul 2020 13:57:52 +0800 Message-ID: <1594360672-2076-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-TM-SNTS-SMTP: A4E306D334522FFBCC74B2420148282F0928E1E8771E2A2BEF95B67EF98867B52000:8 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Fixes: 0cbd4b34cda9("xhci: mediatek: support MTK xHCI host controller") Signed-off-by: Chunfeng Yun --- V2: add Fixes suggested by Nicolas --- drivers/usb/host/xhci-mtk-sch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index fea5555..45c54d56 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -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; }