Received: by 10.213.65.68 with SMTP id h4csp3939084imn; Tue, 10 Apr 2018 06:57:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oq/rmT4B7pgfS1XBVx9yvZzg1+hAjHEdk6AXc41ZhFhe9LOydrbD+aSBD5PITaKkWq+eH X-Received: by 10.101.96.10 with SMTP id m10mr371323pgu.281.1523368656437; Tue, 10 Apr 2018 06:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523368656; cv=none; d=google.com; s=arc-20160816; b=Xui3HKSnviBf14Ql4IjtKm4Zt4soROTcNzL2knSuL20m+/hqwuN0DpociTFvJI5E25 96wLS3TPvPwtn9w++tD0yEShPM3P14j5EnknPb8x/eiRpJdM3EDBQUNvKQghHGl4vs75 WdRxp9SEUQHf3HkPUKDvg36LwB+//RWsDlLZOhtE4A5i12/49b+UwnucT19GrruAaOMV khIjdRGOSJ2w0OxS3mZZKUoNuBYW9IzTkpC3Ntrb1AiM+RS4rY2SHk2EO8Cqkve8ORqk WXW7Aw7CAoo6vutqT3JWzeYtHw87D8ykcUZl8OQAnkt10ctAWxI5w3EQZJmeVmKY8MvU tQyg== 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=t7nCGGRdYlt/oBCD88ge8r8aT040vy3Uef+GX9KMfkU=; b=VfVNVbSPoSN5kRDNRG30BtIPmxscUwXRDWBaZ4QVAmMnmLa/OsnMWagnkVCBaeX65J qSwsvPRhpLqicf51yka+QhKXNUidVDS6ZprcNUSTAkZNmPNKyO9wsuClVrw3TbmsSF+M B0mXu3yxXGurK2TeqtqEz+RtPe3scnn8PTTDafsP6joT6vE6PY1FcHDP+gBhiYjAbJij P5GEHybf6RnQubDHETHjMfOaQgFUHerzBNxwrbblaxSAe/57IY81RPA2OUeIZUy0hR96 z9GjTmTu+L4+IIaDy5ok7PW5SGOTsM1vPES4Bo4wz6Z065ezfFiRNzJyGTLNCdSBiats 6b8A== 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 c143si2137203pfc.197.2018.04.10.06.56.59; Tue, 10 Apr 2018 06:57:36 -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 S1754029AbeDJNwc convert rfc822-to-8bit (ORCPT + 99 others); Tue, 10 Apr 2018 09:52:32 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:55345 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753765AbeDJNw3 (ORCPT ); Tue, 10 Apr 2018 09:52:29 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 0CA2610C057E; Tue, 10 Apr 2018 06:52:28 -0700 (PDT) Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 68D0A5DAE; Tue, 10 Apr 2018 06:52:28 -0700 (PDT) Received: from AM04WEHTCB.internal.synopsys.com (10.116.16.192) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 10 Apr 2018 06:52:28 -0700 Received: from AM04WEMBXB.internal.synopsys.com ([fe80::1006:bcdd:1b7:579b]) by am04wehtcb.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Tue, 10 Apr 2018 17:52:25 +0400 From: Minas Harutyunyan To: Heiko Stuebner , Tomeu Vizoso CC: "linux-kernel@vger.kernel.org" , "Felipe Balbi" , 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: Tue, 10 Apr 2018 13:52:25 +0000 Message-ID: <410670D7E743164D87FA6160E7907A560113AE7E5C@am04wembxb.internal.synopsys.com> References: <20180322093943.49717-1-tomeu.vizoso@collabora.com> <20180326090001.57627-1-tomeu.vizoso@collabora.com> <4613360.AXT7q7Ng0i@phil> 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 Heiko, On 4/10/2018 4:28 PM, Heiko Stuebner wrote: > Am Montag, 26. M?rz 2018, 11:00:01 CEST schrieb Tomeu Vizoso: >> 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 > > The patch that gets fixed here also breaks display-output on dwc2-based > Rockchip devices (likely even more), probably due to making the regulator > framework hickup. > Could you please elaborate what mean "breaks display-output". On which Kernel version you apply this patch? Thanks, Minas > With this patch applied, apart from not seeing the NULL-ptr, I also get > display output on my rk3288-veycron Chromebook again, so > > Tested-by: Heiko Stuebner > > >> 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); >> } >> >> /* >> > > >