Received: by 10.213.65.68 with SMTP id h4csp1642310imn; Thu, 5 Apr 2018 00:56:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Hwt9eK3vfy+pXWI1SKDozmatsdmSLw7GSjRv+iv8gCRzHRWnWxdwRHrp2mkqhoObiixae X-Received: by 2002:a17:902:7894:: with SMTP id q20-v6mr22244885pll.86.1522914978794; Thu, 05 Apr 2018 00:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522914978; cv=none; d=google.com; s=arc-20160816; b=vK3orZXPdQRg2qE26i/qsZ68GhLUEAJbc4Ziumwgw/PpO5FE35Tuia2cXj8XauMIq0 DzfMMeluipYSdUeJ39Gq9EnTAlRraKDYIHwXF20FA8JnXU1azPbKrtBoqZOJ4ZTGhtpv yTYueZ6WiXvlrNgyDJzqOJmicNRuUc0BSoUdDs17IQT6FoSlxs63PrC84QilVuYdzeCB q7RcVA4Ty3cjFX5jVZiMYT3K0bhJA72QLoSyXjqK7vce6WjMUeVjmmMWwgvtYIz5cuyL 8pInQWqjcI2Ku8utKzqWaQZ9ESrxTK9ZRnT+AQMmEtdN52/9/uE9y1vePqokuqGUQa2Q SqgA== 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=gcysgAfPtF1ZyCWmFZLTpED2rkQ1dVusSDdWtKq7yf4=; b=aE1mwHjOfuwN2txNWBobyahcDTn5MoNxUlBJ4wIM5lv+Y0M5/dEt3jWtgorp0JUu96 63K6qVbei0Fu8u1yXyEMROKuc3qiLrSOFDxe/NQRB0wNXtpz+govpQ2/FZpmII59HwXM wwMxd6248EQz0gTbgtRSHHAiOepYJbuz7zqTeSg/IFL94kwlTKAwrK2r4J23s75RsNTi bPebBRJ4UJg+9iC3w0pu8w8frmJ9XuXSFDz9N7TTuflnChRuIuVX94JozxGnGlY4QqWr ycyvVTsBNvIVJc2QBk6zYUoafyC2rsV096w/V6wmulPRjRzi4Agfk/UXmYDBHLebMBPY 9VbA== 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 207si5666288pfz.108.2018.04.05.00.56.04; Thu, 05 Apr 2018 00:56:18 -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 S1751389AbeDEHy6 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Apr 2018 03:54:58 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:45485 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbeDEHy4 (ORCPT ); Thu, 5 Apr 2018 03:54:56 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 03F6324E07B9; Thu, 5 Apr 2018 00:54:55 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id CDC1F381B; Thu, 5 Apr 2018 00:54:55 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 6516E3819; Thu, 5 Apr 2018 00:54:55 -0700 (PDT) Received: from AM04WEHTCA.internal.synopsys.com (10.116.16.190) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 5 Apr 2018 00:54:55 -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 11:54:52 +0400 From: Minas Harutyunyan To: Tomeu Vizoso , "linux-kernel@vger.kernel.org" CC: Felipe Balbi , Heiko Stuebner , Amelie Delaunay , "Minas Harutyunyan" , 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: AQHTxOD8nEoVzOZ04EOGN7z3QZ1Kzw== Date: Thu, 5 Apr 2018 07:54:51 +0000 Message-ID: <410670D7E743164D87FA6160E7907A560113AE527D@am04wembxb.internal.synopsys.com> References: <20180322093943.49717-1-tomeu.vizoso@collabora.com> <20180326090001.57627-1-tomeu.vizoso@collabora.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.63] 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 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 Thanks, Minas