Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1582631

[PATCH 1/2] mmc: meson-gx: prevent cfg_div_clk from being disabled on init

From Michał Zegan <webczat@webczatnet.pl>
Newsgroups linux.kernel
Subject [PATCH 1/2] mmc: meson-gx: prevent cfg_div_clk from being disabled on init
Date 2017-02-16 16:00 +0100
Message-ID <tbvHk-7E6-17@gated-at.bofh.it> (permalink)
References <tbvHk-7E6-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


At the end of function meson_mmc_clk_init, the cfg_div clock was
prepared, enabled and configured, but then immediately disabled due to bogus if statements.
That made later calls to clk_disable_unprepare executed during module removal to fail with a kernel warning.
Fix that by changing the code to disable clock only when it failed to be configured.

Signed-off-by: Michał Zegan <webczat@webczatnet.pl>
---
 drivers/mmc/host/meson-gx-mmc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 09739352834c..d444b6bfa02b 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -324,11 +324,12 @@ static int meson_mmc_clk_init(struct meson_host *host)
 	writel(cfg, host->regs + SD_EMMC_CFG);
 
 	ret = clk_prepare_enable(host->cfg_div_clk);
-	if (!ret)
+	if (!ret) {
 		ret = meson_mmc_clk_set(host, f_min);
 
-	if (!ret)
-		clk_disable_unprepare(host->cfg_div_clk);
+		if (ret)
+			clk_disable_unprepare(host->cfg_div_clk);
+	}
 
 	return ret;
 }
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] mmc: meson-gx: prevent cfg_div_clk from being disabled on init Michał Zegan <webczat@webczatnet.pl> - 2017-02-16 16:00 +0100
  Re: [PATCH 1/2] mmc: meson-gx: prevent cfg_div_clk from being  disabled on init Michał Zegan <webczat@webczatnet.pl> - 2017-02-17 20:50 +0100
  Re: [PATCH 1/2] mmc: meson-gx: prevent cfg_div_clk from being disabled on init Kevin Hilman <khilman@baylibre.com> - 2017-02-17 20:50 +0100

csiph-web