[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b4779523002ceef3e95887bbcf7ed570cdd93a95.1323328267.git.LW@KARO-electronics.de>
Date: Thu, 8 Dec 2011 09:17:46 +0100
From: Lothar Waßmann <LW@...O-electronics.de>
To: Shawn Guo <shawn.guo@...aro.org>
Cc: Sascha Hauer <kernel@...gutronix.de>, linux-mmc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Chris Ball <cjb@...top.org>,
Lothar Waßmann <LW@...O-electronics.de>
Subject: [MXS MMC v2 3/4] Check the return codes of clk_enable() and mxs_reset_block()
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@...O-electronics.de>
Acked-by: Shawn Guo <shawn.guo@...aro.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists