[PATCH v3 3/4] mmc: mxs-mmc: Check the return codes of clk_enable() and mxs_reset_block()
From: Lothar WaÃmann
Date: Thu Dec 08 2011 - 04:45:40 EST
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@xxxxxxxxxxxxxxxxxxx>
Acked-by: Shawn Guo <shawn.guo@xxxxxxxxxx>
Acked-by: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/