Commit b1ade0f2 authored by Fabio Estevam's avatar Fabio Estevam Committed by Mark Brown

ASoC: fsl: fsl_asrc: Check for clk_prepare_enable() error

clk_prepare_enable() may fail, so we should better check its return value
and propagate it in the case of error.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Acked-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d770e558
...@@ -931,14 +931,29 @@ static int fsl_asrc_probe(struct platform_device *pdev) ...@@ -931,14 +931,29 @@ static int fsl_asrc_probe(struct platform_device *pdev)
static int fsl_asrc_runtime_resume(struct device *dev) static int fsl_asrc_runtime_resume(struct device *dev)
{ {
struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
int i; int i, ret;
clk_prepare_enable(asrc_priv->mem_clk); ret = clk_prepare_enable(asrc_priv->mem_clk);
clk_prepare_enable(asrc_priv->ipg_clk); if (ret)
for (i = 0; i < ASRC_CLK_MAX_NUM; i++) return ret;
clk_prepare_enable(asrc_priv->asrck_clk[i]); ret = clk_prepare_enable(asrc_priv->ipg_clk);
if (ret)
goto disable_mem_clk;
for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
ret = clk_prepare_enable(asrc_priv->asrck_clk[i]);
if (ret)
goto disable_asrck_clk;
}
return 0; return 0;
disable_asrck_clk:
for (i--; i >= 0; i--)
clk_disable_unprepare(asrc_priv->asrck_clk[i]);
clk_disable_unprepare(asrc_priv->ipg_clk);
disable_mem_clk:
clk_disable_unprepare(asrc_priv->mem_clk);
return ret;
} }
static int fsl_asrc_runtime_suspend(struct device *dev) static int fsl_asrc_runtime_suspend(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment