From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: "Sascha Hauer" <kernel@pengutronix.de>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, "Chris Ball" <cjb@laptop.org>,
"Lothar Waßmann" <LW@KARO-electronics.de>
Subject: [MXS MMC v2 3/4] Check the return codes of clk_enable() and mxs_reset_block()
Date: Thu, 8 Dec 2011 09:17:46 +0100 [thread overview]
Message-ID: <b4779523002ceef3e95887bbcf7ed570cdd93a95.1323328267.git.LW@KARO-electronics.de> (raw)
In-Reply-To: <d935557e044d2ebc56b4e70487b519fe722e9017.1323328267.git.LW@KARO-electronics.de>
In-Reply-To: <cover.1323328267.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>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
---
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
@@ -190,11 +190,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) |
@@ -219,6 +222,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,
@@ -717,9 +721,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);
@@ -834,7 +848,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
next prev parent reply other threads:[~2011-12-08 8:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-08 8:17 [MXS MMC v2 0/4] Some cleanups and fixes for the MXS MMC subsystem Lothar Waßmann
2011-12-08 8:17 ` [MXS MMC v2 1/4] Fix grammatical error in comment Lothar Waßmann
2011-12-08 8:17 ` [MXS MMC v2 2/4] Some cleanups for the MMC driver Lothar Waßmann
2011-12-08 8:17 ` Lothar Waßmann [this message]
2011-12-08 8:17 ` [MXS MMC 4/4] Add an appropriate MODULE_ALIAS Lothar Waßmann
2011-12-08 8:54 ` Wolfram Sang
2011-12-08 8:53 ` [MXS MMC v2 3/4] Check the return codes of clk_enable() and mxs_reset_block() Wolfram Sang
2011-12-08 9:17 ` [MXS MMC v2 2/4] Some cleanups for the MMC driver Shawn Guo
2011-12-08 8:52 ` [MXS MMC v2 1/4] Fix grammatical error in comment Wolfram Sang
2011-12-08 8:52 ` [MXS MMC v2 0/4] Some cleanups and fixes for the MXS MMC subsystem Wolfram Sang
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.1323328267.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®