summaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/fsl_asrc.c
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2015-06-20 23:00:13 +0200
committerMark Brown <broonie@kernel.org>2015-07-07 14:31:52 +0200
commitb1ade0f2afe283d59eb313e5717870fdb831fc4e (patch)
tree61618a1e0d10f2a0ee218e655c6df00d2017d4e6 /sound/soc/fsl/fsl_asrc.c
parentLinux 4.2-rc1 (diff)
downloadlinux-b1ade0f2afe283d59eb313e5717870fdb831fc4e.tar.xz
linux-b1ade0f2afe283d59eb313e5717870fdb831fc4e.zip
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: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl/fsl_asrc.c')
-rw-r--r--sound/soc/fsl/fsl_asrc.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index c068494bae30..9f087d4f73ed 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -931,14 +931,29 @@ static int fsl_asrc_probe(struct platform_device *pdev)
static int fsl_asrc_runtime_resume(struct device *dev)
{
struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
- int i;
+ int i, ret;
- clk_prepare_enable(asrc_priv->mem_clk);
- clk_prepare_enable(asrc_priv->ipg_clk);
- for (i = 0; i < ASRC_CLK_MAX_NUM; i++)
- clk_prepare_enable(asrc_priv->asrck_clk[i]);
+ ret = clk_prepare_enable(asrc_priv->mem_clk);
+ if (ret)
+ return ret;
+ 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;
+
+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)