Received: by 10.213.65.68 with SMTP id h4csp1655618imn; Thu, 5 Apr 2018 01:12:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx49sYNoamBeEe2ghAlH9V8z/TL26s0ITKuwmjkjQ3w8qZY3pYA2GQJeKNbRpmhAixlEB6mkV X-Received: by 2002:a17:902:a608:: with SMTP id u8-v6mr22120133plq.25.1522915943649; Thu, 05 Apr 2018 01:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522915943; cv=none; d=google.com; s=arc-20160816; b=WBfJtOlpQP2mRpD3rqqNXzeDxFeCJsBjx7JESKE53tZkdKbc0vq4nCGpY/DO3+qZPh ZBCpHWGijgU3G5fBqvdWYKThq49UEigUr+RUzJabFiSR/E4IUNqhG1ifoyQDLQ9RUq5y PbByRoZNhQkDZPv/ZAB1GRalNq0YY0ZE5dPdD4pALWjQnOWsGwVNZogxsNgu4uxXdSqw D1x9H8EVaGYFWJ2gCLr8exaCs8m+WmzOzj44PhSNTsjGqWIjLlLZgw+x+ycOc9I9QSBn Gls5TIFEgom+6NV8/X/Q11k2FBPhZNLrrP97g1fPJ/I6lCHSyOWxo72IwBkXMu73b3hy Fbow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=AWDp1w2ikwEZks39KtclSwgW520WDW7+xajEgRos4xE=; b=rvFLnvS+YTN7Oujq+0dMMKoAuBx48vnnoG1gOKMZNaoxQ09LR9bhveij1tS5NPUMTu C7tEl3TXdey7058w0H9SC3k8nmJw+1nFi/4l/z70A8eZQLDWxZCbVO6vmI6fcqhWvUgb u30DooqMCujjd21P4qDbeDNtOeDYQMV7eZqyaa73+WpbHKrC7OJy1d9/pCarKS5CuydT 1+kWLuGGEjPT95jBw57tPsPPg1Lg9www7ArBXBPhA4xaai4c6SXmxUor5f194iWCCrsn RRT9u+5JdGachMqEUfzsXeuc/jbmCzealRBmDIll7OQ56vz+BS09+orAlN3wwd9zRxqo xhEg== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1-v6si2993430plh.375.2018.04.05.01.12.09; Thu, 05 Apr 2018 01:12:23 -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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751461AbeDEIK4 (ORCPT + 99 others); Thu, 5 Apr 2018 04:10:56 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59484 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbeDEIKx (ORCPT ); Thu, 5 Apr 2018 04:10:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tomeu) with ESMTPSA id B732B273614 Subject: Re: [PATCH v4] usb: dwc2: dwc2_vbus_supply_init: fix error check To: Minas Harutyunyan , "linux-kernel@vger.kernel.org" Cc: Felipe Balbi , Heiko Stuebner , Amelie Delaunay , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" References: <20180322093943.49717-1-tomeu.vizoso@collabora.com> <20180326090001.57627-1-tomeu.vizoso@collabora.com> <410670D7E743164D87FA6160E7907A560113AE527D@am04wembxb.internal.synopsys.com> From: Tomeu Vizoso Message-ID: Date: Thu, 5 Apr 2018 10:10:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <410670D7E743164D87FA6160E7907A560113AE527D@am04wembxb.internal.synopsys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Tomeu