mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: linux-arm-kernel@lists.infradead.org
Cc: "Shawn Guo" <shawn.guo@linaro.org>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Chris Ball" <cjb@laptop.org>,
	"Lothar Waßmann" <LW@KARO-electronics.de>
Subject: [MXS MMC 4/5] Check the return codes of clk_enable() and mxs_reset_block()
Date: Tue,  6 Dec 2011 14:41:29 +0100	[thread overview]
Message-ID: <b4779523002ceef3e95887bbcf7ed570cdd93a95.1323177907.git.LW@KARO-electronics.de> (raw)
In-Reply-To: <e668bb1ab5fbe406ef604a18f59292a05149ae51.1323177907.git.LW@KARO-electronics.de>
In-Reply-To: <cover.1323177907.git.LW@KARO-electronics.de>

Add an int return value to mxs_mmc_reset(), so that the return code of
mxs_reset_block() can be promoted to the caller.
Also check the return code of clk_enable() in the probe function.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/mmc/host/mxs-mmc.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index a9b70d2..0003d03 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -185,11 +185,14 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
 		 BM_SSP_STATUS_CARD_DETECT);
 }
 
-static void mxs_mmc_reset(struct mxs_mmc_host *host)
+static int mxs_mmc_reset(struct mxs_mmc_host *host)
 {
+	int ret;
 	u32 ctrl0, ctrl1;
 
-	mxs_reset_block(host->base);
+	ret = mxs_reset_block(host->base);
+	if (ret)
+		return ret;
 
 	ctrl0 = BM_SSP_CTRL0_IGNORE_CRC;
 	ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) |
@@ -214,6 +217,7 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host)
 
 	writel(ctrl0, host->base + HW_SSP_CTRL0);
 	writel(ctrl1, host->base + HW_SSP_CTRL1);
+	return 0;
 }
 
 static void mxs_mmc_start_cmd(struct mxs_mmc_host *host,
@@ -712,9 +716,19 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 		ret = PTR_ERR(host->clk);
 		goto out_iounmap;
 	}
-	clk_enable(host->clk);
+	ret = clk_enable(host->clk);
+	if (ret) {
+		dev_err(mmc_dev(host->mmc),
+			"%s: failed to enable clock: %d\n", __func__, ret);
+		goto out_clk_put;
+	}
 
-	mxs_mmc_reset(host);
+	ret = mxs_mmc_reset(host);
+	if (ret) {
+		dev_err(mmc_dev(host->mmc),
+			"%s: failed to reset controller: %d\n", __func__, ret);
+		goto out_clk_put;
+	}
 
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
@@ -829,7 +843,9 @@ static int mxs_mmc_resume(struct device *dev)
 	struct mxs_mmc_host *host = mmc_priv(mmc);
 	int ret = 0;
 
-	clk_enable(host->clk);
+	ret = clk_enable(host->clk);
+	if (ret)
+		return ret;
 
 	ret = mmc_resume_host(mmc);
 
-- 
1.5.6.5


  reply	other threads:[~2011-12-06 13:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 13:41 [MXS MMC 0/5] Some cleanups and fixes for the MXS MMC subsystem Lothar Waßmann
2011-12-06 13:41 ` [MXS MMC 1/5] Fix grammatical error in comment Lothar Waßmann
2011-12-06 13:41   ` [MXS MMC 2/5] Some cleanups for the MMC driver Lothar Waßmann
2011-12-06 13:41     ` [MXS MMC 3/5] Add support for SSP/MMC ports 2 & 3 Lothar Waßmann
2011-12-06 13:41       ` Lothar Waßmann [this message]
2011-12-06 13:41         ` [MXS MMC 5/5] Add an appropriate MODULE_ALIAS Lothar Waßmann
2011-12-06 19:12           ` Wolfram Sang
2011-12-07 12:34           ` Shawn Guo
2011-12-06 19:12         ` [MXS MMC 4/5] Check the return codes of clk_enable() and mxs_reset_block() Wolfram Sang
2011-12-07 12:33         ` Shawn Guo
2011-12-06 19:10       ` [MXS MMC 3/5] Add support for SSP/MMC ports 2 & 3 Wolfram Sang
2011-12-07 12:30       ` Shawn Guo
2011-12-07 12:01     ` [MXS MMC 2/5] Some cleanups for the MMC driver Shawn Guo
2011-12-07 11:57       ` Lothar Waßmann
2011-12-07 12:16         ` Shawn Guo
2011-12-07 12:50         ` Uwe Kleine-König
2011-12-06 19:05   ` [MXS MMC 1/5] Fix grammatical error in comment Wolfram Sang
2011-12-07 11:00   ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4779523002ceef3e95887bbcf7ed570cdd93a95.1323177907.git.LW@KARO-electronics.de \
    --to=lw@karo-electronics.de \
    --cc=cjb@laptop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®