From patchwork Wed Apr 26 08:34:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9700647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EEBC60245 for ; Wed, 26 Apr 2017 08:35:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B60F27F90 for ; Wed, 26 Apr 2017 08:35:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 100932807B; Wed, 26 Apr 2017 08:35:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC5CC27F90 for ; Wed, 26 Apr 2017 08:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zPg/Fuo9+317wAPRHu013SoxC712Kn9eJzN+6UmdmDQ=; b=oUCicQJkeGcLNj SFDSXTGboUWxK417AGUMZdVSnj0zKs7pwBMC7vjhJEqkee+4MoHRmI34yA/7FlMmIrVp9tPEnWWtK sS+y8GNE/iFWhjIk0Lw345javQL4Mx0fBPYBqHOBwB3lnl+Phf6IXwrTrRH8+MvHV8eCLysawX/uw VuiTd/7SCOL4xo2xxFmsXBvjqlI18KBI+9rl9Nf+EKmp59MlvRLuIrwyEX0hXOt1W8AjGXm60bpLc zXvqLhWvr7D4Yo0nBcE3Wkf00zjVFDI5D87w0NWySvK+f2G7zitGjPIfeXctinxr7e9Ezr6CWFSTD jjEKQZ0kY38ln/ikhlSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d3IPh-0001lr-JH; Wed, 26 Apr 2017 08:35:05 +0000 Received: from mail-bn3nam01on0047.outbound.protection.outlook.com ([104.47.33.47] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3IPd-000147-0n for linux-arm-kernel@lists.infradead.org; Wed, 26 Apr 2017 08:35:03 +0000 Received: from BN3PR03CA0053.namprd03.prod.outlook.com (10.167.1.141) by DM2PR0301MB0608.namprd03.prod.outlook.com (10.160.95.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Wed, 26 Apr 2017 08:34:37 +0000 Received: from BY2FFO11FD024.protection.gbl (2a01:111:f400:7c0c::168) by BN3PR03CA0053.outlook.office365.com (2a01:111:e400:7a4d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12 via Frontend Transport; Wed, 26 Apr 2017 08:34:37 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD024.mail.protection.outlook.com (10.1.15.213) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1047.9 via Frontend Transport; Wed, 26 Apr 2017 08:34:36 +0000 Received: from b29397-desktop (b29397-desktop.ap.freescale.net [10.192.242.114]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v3Q8YXWh002717; Wed, 26 Apr 2017 01:34:34 -0700 Date: Wed, 26 Apr 2017 16:34:28 +0800 From: Peter Chen To: Jisheng Zhang Subject: Re: [PATCH] usb: chipidea: properly handle host or gadget initialization failure Message-ID: <20170426083428.GA4375@b29397-desktop> References: <20170425094311.361-1-jszhang@marvell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170425094311.361-1-jszhang@marvell.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-EOPAttributedMessage: 0 X-Matching-Connectors: 131376692766796982; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39400400002)(39450400003)(39410400002)(39850400002)(39380400002)(39840400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(24454002)(9170700003)(8676002)(229853002)(47776003)(97756001)(4001350100001)(33656002)(104016004)(2906002)(8936002)(105606002)(69596002)(189998001)(106466001)(33716001)(81166006)(54356999)(50986999)(76176999)(23726003)(356003)(53936002)(110136004)(38730400002)(83506001)(6246003)(6666003)(77096006)(54906002)(2950100002)(6916009)(55016002)(46406003)(85426001)(4326008)(305945005)(50466002)(9686003)(1076002)(5660300001)(86362001)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0608; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD024; 1:YhjFZw/t2dN4GGUIJe6ASpMlKbvxb0Q057bL1ohAoRJM7jEgAdJ8ghZCVlITEnMPHpwUjoWULPxaypxOgvrIvK5D2bMZ6c39Qs8KbiVYhlqqc3U8x3Zsk/PyEb0xNdT4Rbj52SHuiIDehFN4k9NHt/V5CTAgKB7mswbqxwjM3+g5Jdt8UqY5LAUUooUlGZLABGtCuWG+/UN+ClMEC9U7PZXHoKDh4MF/TPsrkGR1MTJ2RMzCXMsXiXbAvtGgY7X2e21CSuO2FTu5a1IXo6wHtE6M7K/jqwAlME9siG36P6PL44p2I4mcGO4lCIxu1d7NxyWymUFbYCTV18MxC67iFdMXtJ16xVDzuUvsrZ3M9HeuNrXlR2FhmMQLiJ+sD+3SWvuDEfWd5TZ9zfxTOAM3nARm4XdTx+tXtdYIPe896ELEdsTisRlGLyz6Z9jSkrCJGs7vinHuRZa47DtAaBu7CsTOeHkzcKgvzcjDd0AbRdupsdWn3XIj81zQWf+ex+U+suR9P8zGP3pmquOE1a9RBqjWLurJrkEKSQ1d0BZodcLwOi7vf07qYQyJF1aqDwnPQqqHyMjflfxP2gB7QZ9gVbRV5Ayauas97p2ILOv+jZ5mpDCkyLKafY7QN8grR5Q+ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9a8a2ba-8120-40d6-004d-08d48c7f1283 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:DM2PR0301MB0608; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0608; 3:mhllhJDusBv+W+rx/QNtwr5mUi9ThPCGiRf5QmwCWkew4LyzwBL7y+Kgb9jQCUkrH5GfsVNx7obM5RQpoI+1ptSv1sVhGF3Ole8cZurH9tuaIPnXCrC6xt2lv5Sqv9gN4A38jQ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tTzJx0n+Sp/RiWwd8hDNeJeuhO68pfT+BlhU0b3F+MXT5i2vKqv3gXp8g= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13024025)(13023025)(13018025)(13015025)(8121501046)(13017025)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(20161123565025)(20161123556025); SRVR:DM2PR0301MB0608; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR0301MB0608; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0608; 4:WwK4npv9zrQ42hPFo8NGYLXfbXsJ3LWiyjgW4645fqXpMZzIeBPR3o8JGGgIgV9skXMa5ddEVn0IaGMj1qi13g1ovV805sQle7I7SvyZa4saYGUMk0B68IAdXnobutLbHzyjAX7FFBgpVId+dlWZgYGOU3ilbkUYJzvoqZgqLRlPK/2swWqLzi8uNuxG88jVWhiQGs8akCcughqR4CTSVgQboWIL9H9Pi11XyXQyDqAccFWXkB/cTysAkSTuxiFbsSTQhIv5muDkRIzz869AYk+ho7JOZuLAhN1wkGJbqZlSmcRJdUd1XyDbZJgnjEE5SOOCelSJFV40B1WnH8PTsIjLnFSzmEPAuroW7eDPjxbwK2oZMW7Uuwk6X5HjduFivRAVBVxKq+Dk4ze8dSRdVOiFo4WVPZt9m0icZQ0VxQA9ENPP/e85LgUT+cY403hZYnpeKf/eJVztBOBRbGNp1RHH4sUsQT31dcMXiX4TB8fbfMAA+TUk8bZam5t9tAki0EB/qm81NJkrFFdWU2wCmOJywaq8RjYD1H9/8iOqHxZ1r9J3dTTxTbuhghQw749XqvtPC+70k9ZkHLkf1HdcoPPuNFex91riQxRC1xeYJ8DQblVHjJWUFneqlzGxKJTQyGuOiSasm7ph3PAG+hgS2x/i6b7PTSeRXb+oPB7zz4dZBNC3yC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151D0FCp7c3UQOQTVH/AbM7JjTzMczUHTK9PczvR6YomY1J076E+K4RsB7nmBfX9opSFXEY4PGS/Hrtzftc2LZT5EWjUdA1tRUthbJg5vLtUhCjl+jyCo3TqBBNTNviiDrkg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2017 08:34:36.4456 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0608 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170426_013501_624901_333BA351 X-CRM114-Status: GOOD ( 14.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Apr 25, 2017 at 05:43:11PM +0800, Jisheng Zhang wrote: > If ci_hdrc_host_init() or ci_hdrc_gadget_init() returns error and the > error != -ENXIO, as Peter pointed out, "it stands for initialization > for host or gadget has failed", so we'd better return failure rather > continue. > > Signed-off-by: Jisheng Zhang > --- > drivers/usb/chipidea/core.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 79ad8e91632e..047afdbb7049 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -930,20 +930,28 @@ static int ci_hdrc_probe(struct platform_device *pdev) > /* initialize role(s) before the interrupt is requested */ > if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { > ret = ci_hdrc_host_init(ci); > - if (ret) > - dev_info(dev, "doesn't support host\n"); > + if (ret) { > + if (ret == -ENXIO) > + dev_info(dev, "doesn't support host\n"); > + else > + goto deinit_phy; > + } > } > > if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) { > ret = ci_hdrc_gadget_init(ci); > - if (ret) > - dev_info(dev, "doesn't support gadget\n"); > + if (ret) { > + if (ret == -ENXIO) > + dev_info(dev, "doesn't support gadget\n"); > + else > + goto deinit_host; > + } > } > > if (!ci->roles[CI_ROLE_HOST] && !ci->roles[CI_ROLE_GADGET]) { > dev_err(dev, "no supported roles\n"); > ret = -ENODEV; > - goto deinit_phy; > + goto deinit_gadget; > } > > if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) { > @@ -1013,7 +1021,12 @@ static int ci_hdrc_probe(struct platform_device *pdev) > return 0; > > stop: > - ci_role_destroy(ci); > + if (ci->is_otg) > + ci_hdrc_otg_destroy(ci); > +deinit_gadget: > + ci_hdrc_gadget_destroy(ci); > +deinit_host: > + ci_hdrc_host_destroy(ci); > deinit_phy: > ci_usb_phy_exit(ci); > ulpi_exit: > -- > 2.11.0 > You change is ok, there are more things need to change for this issue, would you mind adding below changes to your patch, and send v2. Below changes are based on your changes. diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index c55bcdd..4cad8a9 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -818,7 +818,7 @@ static inline void ci_role_destroy(struct ci_hdrc *ci) { ci_hdrc_gadget_destroy(ci); ci_hdrc_host_destroy(ci); - if (ci->is_otg) + if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) ci_hdrc_otg_destroy(ci); } @@ -1005,7 +1005,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ret = ci_hdrc_otg_init(ci); if (ret) { dev_err(dev, "init otg fails, ret = %d\n", ret); - goto stop; + goto deinit_gadget; } } @@ -1075,7 +1075,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) remove_debug: dbg_remove_files(ci); stop: - if (ci->is_otg) + if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) ci_hdrc_otg_destroy(ci); deinit_gadget: ci_hdrc_gadget_destroy(ci);