summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-mxs.c
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-07-10 07:16:28 +0400
committerMark Brown <broonie@linaro.org>2013-07-15 14:38:42 +0400
commit9c4a39afaa2ef8f96b7bda1ffb5deef0e98ad189 (patch)
treeab349d7dfec34a3532568350a3b96a0f222cbf42 /drivers/spi/spi-mxs.c
parente11933f626c0a1333ec118d35a0c6c90d576b707 (diff)
downloadlinux-9c4a39afaa2ef8f96b7bda1ffb5deef0e98ad189.tar.xz
spi: spi-mxs: Check the return value from clk_prepare_enable()
clk_prepare_enable() may fail, so let's check its return value and propagate it in the case of error. While at it, rename 'out_free_dma' to 'out_disable_clk' so that it can properly describe its purpose. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-mxs.c')
-rw-r--r--drivers/spi/spi-mxs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 92254a1672e7..ecc59444875c 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -563,7 +563,10 @@ static int mxs_spi_probe(struct platform_device *pdev)
goto out_master_free;
}
- clk_prepare_enable(ssp->clk);
+ ret = clk_prepare_enable(ssp->clk);
+ if (ret)
+ goto out_dma_release;
+
clk_set_rate(ssp->clk, clk_freq);
ssp->clk_rate = clk_get_rate(ssp->clk) / 1000;
@@ -574,13 +577,14 @@ static int mxs_spi_probe(struct platform_device *pdev)
ret = spi_register_master(master);
if (ret) {
dev_err(&pdev->dev, "Cannot register SPI master, %d\n", ret);
- goto out_free_dma;
+ goto out_disable_clk;
}
return 0;
-out_free_dma:
+out_disable_clk:
clk_disable_unprepare(ssp->clk);
+out_dma_release:
dma_release_channel(ssp->dmach);
out_master_free:
spi_master_put(master);