From patchwork Tue Mar 17 00:42:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6026761 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 8E00C9F318 for ; Tue, 17 Mar 2015 00:42:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1DBB2041A for ; Tue, 17 Mar 2015 00:42:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF8E5203E3 for ; Tue, 17 Mar 2015 00:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbbCQAmo (ORCPT ); Mon, 16 Mar 2015 20:42:44 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35316 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbbCQAmn (ORCPT ); Mon, 16 Mar 2015 20:42:43 -0400 Received: by pabyw6 with SMTP id yw6so80393707pab.2 for ; Mon, 16 Mar 2015 17:42:42 -0700 (PDT) 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=KKWxDkY4G51DNBnh1yyM7oIyvipDZckO2AmDrt77CqM=; b=Liq+cZs5qYKbpS2xrhCUnHi4a6wxDxT9j3bAuvvn2s0EbR7cjfEIRn+JJR9DCy5//a EvtyYlzb3canCBUind62kO+rvyuSgNIQpXUagSaDwOA4uV3ltXmRFhFS24ElcO0R4S6c r9j9WDG/cL5NhDQfaX2wb2tAuGda4mCX5X/j08MNkMb6+mO19lCVv8dZUrSf0WvPa0cg MzlH2kjErh6Y36CCkxErcCNHS4WH04NDM1CRc1S6dhbe+hnck8EEUqBrOqooDvtmRgDv Uz8/+0hPNi6O7v1tuk+R2WXs/XVIY4QLqV+jENxRfl4cF6vBm72/nf+js9NpjJGDW2+F qk8g== X-Gm-Message-State: ALoCoQkeHjv5J5xEfi7978gK9C+o3vjTpk7iaiXy+b8fpqKJdx/zVJIEjJv3kfUmY6JJIq2pqS0N X-Received: by 10.70.94.169 with SMTP id dd9mr31968677pdb.34.1426552962494; Mon, 16 Mar 2015 17:42:42 -0700 (PDT) Received: from [10.118.51.213] ([60.245.64.174]) by mx.google.com with ESMTPSA id pa6sm19264612pac.45.2015.03.16.17.42.40 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 17:42:41 -0700 (PDT) Message-ID: <1426552958.6645.3.camel@phoenix> Subject: [PATCH] phy: samsung_usb2: Fixup samsung_usb2_phy_power_on/off paths From: Axel Lin To: Kishon Vijay Abraham I Cc: Kamil Debski , linux-kernel@vger.kernel.org, "linux-samsung-soc@vger.kernel.org" Date: Tue, 17 Mar 2015 08:42:38 +0800 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Ensure we have balanced clk_prepare_enable/clk_disable_unprepare calls if .power_on or .power_off callbacks return error. Signed-off-by: Axel Lin --- drivers/phy/phy-samsung-usb2.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 4a12f66..55b6994 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c @@ -37,10 +37,14 @@ static int samsung_usb2_phy_power_on(struct phy *phy) spin_lock(&drv->lock); ret = inst->cfg->power_on(inst); spin_unlock(&drv->lock); + if (ret) + goto err_power_on; } return 0; +err_power_on: + clk_disable_unprepare(drv->ref_clk); err_instance_clk: clk_disable_unprepare(drv->clk); err_main_clk: @@ -51,7 +55,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy) { struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy); struct samsung_usb2_phy_driver *drv = inst->drv; - int ret = 0; + int ret; dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n", inst->cfg->label); @@ -59,10 +63,12 @@ static int samsung_usb2_phy_power_off(struct phy *phy) spin_lock(&drv->lock); ret = inst->cfg->power_off(inst); spin_unlock(&drv->lock); + if (ret) + return ret; } clk_disable_unprepare(drv->ref_clk); clk_disable_unprepare(drv->clk); - return ret; + return 0; } static struct phy_ops samsung_usb2_phy_ops = {