From patchwork Wed Mar 4 01:33:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 5927811 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 20BCD9F36A for ; Wed, 4 Mar 2015 01:34:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6331120439 for ; Wed, 4 Mar 2015 01:34:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBCD620437 for ; Wed, 4 Mar 2015 01:34:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YSyCI-0003LO-Tu; Wed, 04 Mar 2015 01:34:02 +0000 Received: from mail-pd0-f174.google.com ([209.85.192.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YSyCG-00036o-BD for linux-rockchip@lists.infradead.org; Wed, 04 Mar 2015 01:34:01 +0000 Received: by pdbfl12 with SMTP id fl12so21834167pdb.9 for ; Tue, 03 Mar 2015 17:33:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=Z/s+KKLRIYmRNB5bVcwnVTXbWjRx32FMBrH8KhnhzO4=; b=THValmm1twduO8JmWHCnlYk1eY+nwUkGv6njcbznKrYN4OpndoAgZPxxH2p4j2ilYX 9VwIzY52UfAzorLETTjM5DWkiAiE5ZJTCEp0FBZzQN93V/leSGSwJey5h/YEDB855HAR sUX4QvaNm2nuz9j9owYL4ZBDsJ8l4wVBCFVUH6Nfi6eBGAjFTPilP/1QKHt6sE0b4yNE Lz9k+Rhag4KhT3ZKNt6aMbiiFyo1+FZ5aVGC5OiEzFWmLrVDcBWhlkMmUH1EzIHTr/2z LNpbvxkJAovFKsaSMKGYMn33KYET672LMQuQcVNXw9P2NApCLAJYlitU92LqAQubWYXF WZ4Q== X-Gm-Message-State: ALoCoQnTceMpo4dvNcnTj6nIfCUZ/hdTLy6emOWhGaSTflc2ql+01bb1UbAqfzzSOtkVuos+Rz7r X-Received: by 10.70.52.131 with SMTP id t3mr2616261pdo.110.1425432817561; Tue, 03 Mar 2015 17:33:37 -0800 (PST) Received: from [192.168.1.102] (114-43-221-221.dynamic.hinet.net. [114.43.221.221]) by mx.google.com with ESMTPSA id os6sm2205764pac.28.2015.03.03.17.33.34 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2015 17:33:36 -0800 (PST) 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 Date: Wed, 04 Mar 2015 09:33:32 +0800 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150303_173400_458324_BF755D33 X-CRM114-Status: UNSURE ( 7.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: linux-rockchip@lists.infradead.org, Heiko Stuebner , Yunzhi Li , linux-kernel@vger.kernel.org, Doug Anderson X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }