Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbcDZBQO (ORCPT ); Mon, 25 Apr 2016 21:16:14 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:41898 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbcDZBQL (ORCPT ); Mon, 25 Apr 2016 21:16:11 -0400 Subject: Re: [PATCH] usb: ehci-platform: add reset controller number in struct ehci_platform_priv To: Alan Stern References: CC: , , , , , , , , , , , From: Jiancheng Xue Message-ID: <571EC16C.2050704@hisilicon.com> Date: Tue, 26 Apr 2016 09:16:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.217.211] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.571EC156.0141,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3f445d4fd00a7548c9589ced345f6048 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1626 Lines: 64 Hi Alan, On 2016/4/25 22:43, Alan Stern wrote: > On Sat, 23 Apr 2016, Jiancheng Xue wrote: > >> Some generic-ehci compatible controllers have more than one reset signal >> lines, e.g., Synopsys DWC USB2.0 Host-AHB Controller has two resets bus_reset >> and roothub_reset. Two more resets are added in this patch in order for this >> kind of controller to use this driver directly. >> >> Signed-off-by: Jiancheng Xue > > >> + for (rst = 0; rst < EHCI_MAX_RSTS; rst++) { >> + priv->rsts[rst] = of_reset_control_get_by_index( >> + dev->dev.of_node, rst); >> + if (IS_ERR(priv->rsts[rst])) { >> + err = PTR_ERR(priv->rsts[rst]); >> + if (err == -EPROBE_DEFER) >> + goto err_reset; >> + priv->rsts[rst] = NULL; >> + break; >> + } >> + >> + err = reset_control_deassert(priv->rsts[rst]); >> if (err) >> - goto err_put_clks; >> + goto err_reset; > > If an error occurs here... > Sorry. It's really a problem. I'll modify it in v2 like below: err = reset_control_deassert(priv->rsts[rst]); if(err) { reset_control_put(priv->rsts[rst]); goto err_reset; } >> } >> >> if (pdata->big_endian_desc) >> @@ -300,8 +305,10 @@ err_power: >> if (pdata->power_off) >> pdata->power_off(dev); >> err_reset: >> - if (priv->rst) >> - reset_control_assert(priv->rst); >> + while (--rst >= 0) { >> + reset_control_assert(priv->rsts[rst]); >> + reset_control_put(priv->rsts[rst]); >> + } > > You won't call reset_control_put() for the offending reset line. > See above. Is it OK except this bug? If so, I'll send out v2 patch. Thank you very much! Regards. Jiancheng