From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755833AbbCDBdj (ORCPT ); Tue, 3 Mar 2015 20:33:39 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:41445 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500AbbCDBdi (ORCPT ); Tue, 3 Mar 2015 20:33:38 -0500 Message-ID: <1425432812.10378.2.camel@phoenix> Subject: [PATCH] phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path From: Axel Lin To: Kishon Vijay Abraham I Cc: Yunzhi Li , Doug Anderson , Heiko Stuebner , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Date: Wed, 04 Mar 2015 09:33:32 +0800 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If rockchip_usb_phy_power() fails, we need to call clk_disable_unprepare() before return. This is to ensure we have balanced clk_enable/disable calls. Also remove unneeded ret checking in rockchip_usb_phy_power_off. Signed-off-by: Axel Lin --- drivers/phy/phy-rockchip-usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c index 22011c3..7d4c336 100644 --- a/drivers/phy/phy-rockchip-usb.c +++ b/drivers/phy/phy-rockchip-usb.c @@ -61,8 +61,6 @@ static int rockchip_usb_phy_power_off(struct phy *_phy) return ret; clk_disable_unprepare(phy->clk); - if (ret) - return ret; return 0; } @@ -78,8 +76,10 @@ static int rockchip_usb_phy_power_on(struct phy *_phy) /* Power up usb phy analog blocks by set siddq 0 */ ret = rockchip_usb_phy_power(phy, 0); - if (ret) + if (ret) { + clk_disable_unprepare(phy->clk); return ret; + } return 0; } -- 1.9.1