From patchwork Tue Mar 17 00:39:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6026751 Return-Path: X-Original-To: patchwork-linux-arm@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 1328B9F318 for ; Tue, 17 Mar 2015 00:41:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BC3C20453 for ; Tue, 17 Mar 2015 00:41:33 +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 7985A20414 for ; Tue, 17 Mar 2015 00:41:32 +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 1YXfXf-0004z1-Jv; Tue, 17 Mar 2015 00:39:31 +0000 Received: from mail-pd0-f176.google.com ([209.85.192.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YXfXc-0004v5-BI for linux-arm-kernel@lists.infradead.org; Tue, 17 Mar 2015 00:39:28 +0000 Received: by pdbni2 with SMTP id ni2so73147020pdb.1 for ; Mon, 16 Mar 2015 17:39:05 -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=4Ev/1x+I9UkmuJZif4zF8EIvT2LfA+trLpFtXLb6KDA=; b=KGXcT5qNt1PwEyDyJJxDpM771ZPXQfThBHmkCHZkMQ+1gRnQ50VqkrvNBOiGPjhaBG 0FZ3jCsv6FsWLYg8RI9b/IM+hdkUw/t3VUyw1BaB5h4hbqvaNp2BIz9+Xxk4OSxt2Ktt ypP82NWDtC0JRFzzWwPeY6XOUHlT0IbOKOr+DqIyO2uYaJMILnB7p/r5Dt8TrpA6ys94 EUfIJdAe/spMsngcqot/TmMENAXBZjgozRPOb1sP3lhV0PlnF0gjc3eGP0d7JV9UhBVQ OqJ23U7EdCtm7wvIhvBqyW/JcuYfNxXmX81Fl1AEhc9Bol21UxTtoRjyQwoGEHoisx8W XqeQ== X-Gm-Message-State: ALoCoQmmtMLlvrlEYD5b8vaZ10dnV4qYDsCBq9t1ni/NvfHnTTHIWjX7KuJIg9GRLd8n/060epxM X-Received: by 10.70.53.137 with SMTP id b9mr145376247pdp.69.1426552745657; Mon, 16 Mar 2015 17:39:05 -0700 (PDT) Received: from [10.118.51.213] ([60.245.64.174]) by mx.google.com with ESMTPSA id os6sm19252351pac.28.2015.03.16.17.39.03 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 17:39:04 -0700 (PDT) Message-ID: <1426552741.6645.1.camel@phoenix> Subject: [PATCH] phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path From: Axel Lin To: Kishon Vijay Abraham I Date: Tue, 17 Mar 2015 08:39:01 +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-20150316_173928_414448_42E0DB54 X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Peter Griffin , kernel@stlinux.com, linux-arm-kernel@lists.infradead.org, Maxime Coquelin X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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 stih41x_usb_phy_power_on() fails, we need to call clk_disable_unprepare() before return error. This is to ensure we have balanced clk_enable/disable calls. Signed-off-by: Axel Lin Acked-by: Patrice Chotard --- drivers/phy/phy-stih41x-usb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-stih41x-usb.c b/drivers/phy/phy-stih41x-usb.c index a603801..c093b47 100644 --- a/drivers/phy/phy-stih41x-usb.c +++ b/drivers/phy/phy-stih41x-usb.c @@ -87,8 +87,12 @@ static int stih41x_usb_phy_power_on(struct phy *phy) return ret; } - return regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg, - phy_dev->cfg->oscok, phy_dev->cfg->oscok); + ret = regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg, + phy_dev->cfg->oscok, phy_dev->cfg->oscok); + if (ret) + clk_disable_unprepare(phy_dev->clk); + + return ret; } static int stih41x_usb_phy_power_off(struct phy *phy)