From patchwork Tue Mar 20 13:19:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10297151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A55D7602C2 for ; Tue, 20 Mar 2018 13:14:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9573B26E46 for ; Tue, 20 Mar 2018 13:14:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8995D27853; Tue, 20 Mar 2018 13:14:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B7C326E46 for ; Tue, 20 Mar 2018 13:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=L63P2J5tjiU++AJaG4WChec0mMNzjlO8TDACRcEguUE=; b=EMMMgQCWejYpRf Svs46cFu0uzirgLGdsXlmX/GzPzq9Vs16Z5FeV0x0xD6gzh3jXeDchuRYZOqwF5FUbc/MSQZh3YRo 03qscgnhp33wRUKHQ4TFjrfGC5lvMJXCwF/b5ROiOT+t5WdKvFfPT2isdsQVYjMYzszFFUicsl7TC KTPg72CTJ16eifjkF8jmVYVskXwGv5vqzmYg6nATzc0oKUy1q2w/Gn2IQYSowQTp5nLAKXfN6Jm25 NV5DuM/q4OWUxmjo1KFx5MgsCRzIueinr80CWQbRHjfQxbsseOpForX3+Ju49HDoGWnAW4UyRpSCB PgFd9+GVqgJDigdJvvnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyH6D-0003ES-JI; Tue, 20 Mar 2018 13:14:45 +0000 Received: from [45.249.212.32] (helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyH5p-0002mh-SI; Tue, 20 Mar 2018 13:14:23 +0000 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 44AD43917049A; Tue, 20 Mar 2018 21:14:04 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Tue, 20 Mar 2018 21:13:57 +0800 From: Wei Yongjun To: Chunfeng Yun , Kishon Vijay Abraham I , Matthias Brugger Subject: [PATCH -next] phy: phy-mtk-tphy: fix missing clk_disable_unprepare() on error in mtk_phy_init() Date: Tue, 20 Mar 2018 13:19:59 +0000 Message-ID: <1521551999-154546-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180320_061422_188473_C6421EB9 X-CRM114-Status: GOOD ( 10.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mediatek@lists.infradead.org, kernel-janitors@vger.kernel.org, Wei Yongjun , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the missing clk_disable_unprepare() before return from mtk_phy_init() in the error handling case. Signed-off-by: Wei Yongjun Tested-by: Chunfeng Yun Acked-by: Chunfeng Yun --- drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index 38c281b..3ff9020 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -841,7 +841,7 @@ static int mtk_phy_init(struct phy *phy) ret = clk_prepare_enable(instance->ref_clk); if (ret) { dev_err(tphy->dev, "failed to enable ref_clk\n"); - return ret; + goto disable_u3phya_ref; } switch (instance->type) { @@ -859,10 +859,17 @@ static int mtk_phy_init(struct phy *phy) break; default: dev_err(tphy->dev, "incompatible PHY type\n"); - return -EINVAL; + ret = -EINVAL; + goto disable_ref_clk; } return 0; + +disable_ref_clk: + clk_disable_unprepare(instance->ref_clk); +disable_u3phya_ref: + clk_disable_unprepare(tphy->u3phya_ref); + return ret; } static int mtk_phy_power_on(struct phy *phy)