spi: spi-imx: 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, fix the order of clk_disable_unprepare calls: clk_ipg should be
disabled first, followed by clk_per.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Fabio Estevam 2013-07-11 01:26:49 -03:00 коммит произвёл Mark Brown
Родитель 130b82c047
Коммит 83174626cc
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -848,8 +848,13 @@ static int spi_imx_probe(struct platform_device *pdev)
goto out_master_put;
}
clk_prepare_enable(spi_imx->clk_per);
clk_prepare_enable(spi_imx->clk_ipg);
ret = clk_prepare_enable(spi_imx->clk_per);
if (ret)
goto out_master_put;
ret = clk_prepare_enable(spi_imx->clk_ipg);
if (ret)
goto out_put_per;
spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
@ -869,8 +874,9 @@ static int spi_imx_probe(struct platform_device *pdev)
return ret;
out_clk_put:
clk_disable_unprepare(spi_imx->clk_per);
clk_disable_unprepare(spi_imx->clk_ipg);
out_put_per:
clk_disable_unprepare(spi_imx->clk_per);
out_master_put:
spi_master_put(master);
@ -885,8 +891,8 @@ static int spi_imx_remove(struct platform_device *pdev)
spi_bitbang_stop(&spi_imx->bitbang);
writel(0, spi_imx->base + MXC_CSPICTRL);
clk_disable_unprepare(spi_imx->clk_per);
clk_disable_unprepare(spi_imx->clk_ipg);
clk_disable_unprepare(spi_imx->clk_per);
spi_master_put(master);
return 0;