Received: by 10.213.65.68 with SMTP id h4csp1694834imn; Thu, 5 Apr 2018 02:03:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+jP7+ViNZbGT/tLz9pI7fKI7euc4Hle8/cYtDrm9xQibYDUvmVG6ydb/s9jygvZF9SKkoQ X-Received: by 2002:a17:902:850c:: with SMTP id bj12-v6mr22338531plb.110.1522919019566; Thu, 05 Apr 2018 02:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522919019; cv=none; d=google.com; s=arc-20160816; b=yiyFFQ9WWXdmg80w+eIKwsr6UEI3u+zXlWxPIakWyKahCc8CD5G3ZzsMGN+ZjeC1Ut hoHqbsvTlPdsKMdp4pL1wJh3YTyTZP2R915MeYvv18nS9V78W+JWfJq/PZr8bXeF7qps 3D+sHBkT4HYpNfz3yYQXv0MvamM4Rx/GuOnP6QHEBmN3pmIqt9wdNFdflTnqlwVv64SW gd1u/nxUe0wRayfRCm1FmDs9O+aSf7QtziTDjI09ll+KBN4bRKFEtKoijzaHfEifp29Z 50qVGDe4cDztUVRr1OcUzWieXKBIpXHINsaBAj3NVpSOejWUTZ5V65pZUdmiopcU6GWF KFpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=6Nh9SmGeQQowVcOyVQ9KEzleG6uBkvFe6VUZgSf57ys=; b=dYbbDKEdG3c/5vi9KtYds2b+8ltq69z2nux6NWO3oMzr+dSsWcAIRAwSCGsvd5yDpU H3kVLDlodZWgM/DL/xqaMp3J5fe1/L6vobDHGOWvHqpybErgSs550FkrMCagh5+aXP3b 7Cc3XdDCdrD/lr//LANdC9LldQN3D7DC+9EdTwibM3Vb3OgBhAAdm+Eba94AvXgFjqbk J1MpQqGjMMKWyxqAvHOx8TQjkCGRHU3JPMDva1tH3MOnbVctFFYOT96csTtHjb0q1LMi 2Kdjjk0DrNVpdTdQhxLD+jV7KLoPKkW3rYnxk5XUxk4eGiQ8MAL9Na4RBNZgy6IATLyO XocA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8-v6si6057022plm.120.2018.04.05.02.03.25; Thu, 05 Apr 2018 02:03:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751487AbeDEJCH convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Apr 2018 05:02:07 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:46504 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeDEJCG (ORCPT ); Thu, 5 Apr 2018 05:02:06 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id B20B424E1022; Thu, 5 Apr 2018 02:02:05 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 8B227354F; Thu, 5 Apr 2018 02:02:05 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id EC67A34FA; Thu, 5 Apr 2018 02:02:04 -0700 (PDT) Received: from AM04WEHTCA.internal.synopsys.com (10.116.16.190) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 5 Apr 2018 02:02:04 -0700 Received: from AM04WEMBXB.internal.synopsys.com ([fe80::1006:bcdd:1b7:579b]) by am04wehtca.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Thu, 5 Apr 2018 13:02:02 +0400 From: Grigor Tovmasyan To: Tomeu Vizoso , Minas Harutyunyan , "linux-kernel@vger.kernel.org" CC: Felipe Balbi , Heiko Stuebner , Amelie Delaunay , "Greg Kroah-Hartman" , "linux-usb@vger.kernel.org" Subject: Re: [PATCH v4] usb: dwc2: dwc2_vbus_supply_init: fix error check Thread-Topic: [PATCH v4] usb: dwc2: dwc2_vbus_supply_init: fix error check Thread-Index: AQHTxOD/EnRsRkoOHE2ZtYRlyd+fGg== Date: Thu, 5 Apr 2018 09:02:01 +0000 Message-ID: <32EB88BF8EC1614E9FB18BD3718BE1A116412638@am04wembxb.internal.synopsys.com> References: <20180322093943.49717-1-tomeu.vizoso@collabora.com> <20180326090001.57627-1-tomeu.vizoso@collabora.com> <410670D7E743164D87FA6160E7907A560113AE527D@am04wembxb.internal.synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.104.144] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/5/2018 12:11 PM, Tomeu Vizoso wrote: > Hi Minas, > > On 04/05/2018 09:54 AM, Minas Harutyunyan wrote: >> Hi Tomeu, >> >> On 3/26/2018 1:01 PM, Tomeu Vizoso wrote: >>> devm_regulator_get_optional returns -ENODEV if the regulator isn't >>> there, so if that's the case we have to make sure not to leave -ENODEV >>> in the regulator pointer. >>> >>> Also, make sure we return 0 in that case, but correctly propagate any >>> other errors. Also propagate the error from _dwc2_hcd_start. >>> >>> Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") >>> Cc: Amelie Delaunay >>> Signed-off-by: Tomeu Vizoso >>> >>> --- >>> >>> v2: Only overwrite the error in the pointer after checking it (Heiko >>> St?bner ) >>> v3: Remove hunks that shouldn't be in this patch >>> v4: Don't overwrite the error code before returning it (kbuild test >>> robot ) >>> --- >>> drivers/usb/dwc2/hcd.c | 13 ++++++++----- >>> 1 file changed, 8 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c >>> index 190f95964000..c51b73b3e048 100644 >>> --- a/drivers/usb/dwc2/hcd.c >>> +++ b/drivers/usb/dwc2/hcd.c >>> @@ -358,9 +358,14 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg) >>> >>> static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) >>> { >>> + int ret; >>> + >>> hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); >>> - if (IS_ERR(hsotg->vbus_supply)) >>> - return 0; >>> + if (IS_ERR(hsotg->vbus_supply)) { >>> + ret = PTR_ERR(hsotg->vbus_supply); >>> + hsotg->vbus_supply = NULL; >>> + return ret == -ENODEV ? 0 : ret; >>> + } >>> >>> return regulator_enable(hsotg->vbus_supply); >>> } >>> @@ -4342,9 +4347,7 @@ static int _dwc2_hcd_start(struct usb_hcd *hcd) >>> >>> spin_unlock_irqrestore(&hsotg->lock, flags); >>> >>> - dwc2_vbus_supply_init(hsotg); >>> - >>> - return 0; >>> + return dwc2_vbus_supply_init(hsotg); >>> } >>> >>> /* >>> >> >> Not able to apply patch. Please rebase to balbi/next > > Are you sure? Just rebased and the resulting patch is identical to what > was sent. Sorry for inconvenience. We fixed the problem. No need to rebase. Thanks, Grigor. > > Thanks, > > Tomeu > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at https://urldefense.proofpoint.com/v2/url?u=http-3A__vger.kernel.org_majordomo-2Dinfo.html&d=DwIDaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=K1ULVL1slpLXpMJJlAXSOxws4tRq0IkTBqxDkyW2hUQ&m=q-x0UcPJc6m4O6WQ6ZklCRyxp1ZT8QOQDRuaA_B6m6c&s=F7VAPO-hcO1TMfvPHhEkJYgX-8exTHxrioO3C6oNubs&e= >