Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754842AbcDYOnw (ORCPT ); Mon, 25 Apr 2016 10:43:52 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:51350 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754736AbcDYOnu (ORCPT ); Mon, 25 Apr 2016 10:43:50 -0400 Date: Mon, 25 Apr 2016 10:43:49 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Jiancheng Xue cc: linux-usb@vger.kernel.org, , , , , , , , , , , Subject: Re: [PATCH] usb: ehci-platform: add reset controller number in struct ehci_platform_priv In-Reply-To: <1461392507-4799-1-git-send-email-xuejiancheng@hisilicon.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1246 Lines: 45 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... > } > > 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. Alan Stern