From patchwork Tue Mar 14 20:05:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Zegan?= X-Patchwork-Id: 9624413 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 35F6860244 for ; Tue, 14 Mar 2017 20:06:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2444C285B3 for ; Tue, 14 Mar 2017 20:06:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D54285B9; Tue, 14 Mar 2017 20:06:19 +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 [65.50.211.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 AE475285B3 for ; Tue, 14 Mar 2017 20:06:18 +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=p9hwRmIgE5dsFYIC8RIQ2Wo54UVU03kdY67z4VvYLp8=; b=hyUdU2AO50mFb4 nYG4f5adYKD7x/adBH7w4wDXcB+zeqQZP6NtMfQjRa6DG8GvQCm7rcCXXmdfZ3WOQjBJBj7vAmr6Q KgQNatjEVEH4llKbq0EAnKm/uRuwCegGqqGGcxlVn+KDtkR95tHjbH0DUaaPNtYF0WbvMmCozumbA Z8EzEvIyPC7gn1ff+pUcZL6Hr2C/BuGMSIyFtuaNpP8g1N92otT0QMVW91pwgV8KQ2BSQllT/ne4X M8v+n7TrvH2edq04P4Q/MW2+1RjTpyKKiv4sfgdqK1j49FpAKQJOJuus56QfDLo8DpoyXj3SEeF5f NdxMQb4gc4T7dAHK14bw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cnsht-0003yx-5y; Tue, 14 Mar 2017 20:06:09 +0000 Received: from webczatnet.pl ([2001:470:71:796::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cnsho-0003wr-Jg for linux-amlogic@lists.infradead.org; Tue, 14 Mar 2017 20:06:07 +0000 Received: from [193.200.46.1] (port=43812 helo=localhost.localdomain) by webczatnet.pl with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1cnshL-0001jZ-9S; Tue, 14 Mar 2017 21:05:35 +0100 From: =?UTF-8?q?Micha=C5=82=20Zegan?= To: Kevin Hilman Subject: [PATCH v2] mmc: meson-gx: fix error path when driver initialization fails before enabling clocks Date: Tue, 14 Mar 2017 21:05:20 +0100 Message-Id: <20170314200520.6276-1-webczat@webczatnet.pl> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170314_130604_858213_21386F3C X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , =?UTF-8?q?Micha=C5=82=20Zegan?= , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Carlo Caione , linux-amlogic@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the case where meson_mmc_probe function fails before core_clk is enabled. Originally, that would result in a try to disable the core clock, and if it was not already enabled, it would result in a kernel warning. This issue is similar to the one with div_clk. Fix it by introducing another error path used only between successfully enabling the core clock, and successfully enabling the div clock. That would ensure that core clock is disabled only if it was enabled before. Signed-off-by: MichaƂ Zegan --- changes since v1: cherry picked on top of mmc next branch drivers/mmc/host/meson-gx-mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index c574e1519623..bd075fef08d4 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -743,7 +743,7 @@ static int meson_mmc_probe(struct platform_device *pdev) ret = meson_mmc_clk_init(host); if (ret) - goto free_host; + goto err_core_clk; /* Stop execution */ writel(0, host->regs + SD_EMMC_START); @@ -783,8 +783,9 @@ static int meson_mmc_probe(struct platform_device *pdev) err_div_clk: clk_disable_unprepare(host->cfg_div_clk); -free_host: +err_core_clk: clk_disable_unprepare(host->core_clk); +free_host: mmc_free_host(mmc); return ret; }