aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-07-21 12:39:08 -0400
committerMark Brown <broonie@linaro.org>2013-07-21 19:58:36 -0400
commit72192366f4e1385fe6e44600aa5b75d0136e3d52 (patch)
tree28d9e8abc89a7f43c412c465eaf4ad0fa65a46f8
parentf3142807fdb965a7ae1c3a8a6fd91ff92a8efa7a (diff)
ASoC: fsl: imx-audmux: 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. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/fsl/imx-audmux.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index e260f1f899db..1a5da1e13077 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -73,8 +73,11 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
73 if (!buf) 73 if (!buf)
74 return -ENOMEM; 74 return -ENOMEM;
75 75
76 if (audmux_clk) 76 if (audmux_clk) {
77 clk_prepare_enable(audmux_clk); 77 ret = clk_prepare_enable(audmux_clk);
78 if (ret)
79 return ret;
80 }
78 81
79 ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); 82 ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port));
80 pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); 83 pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port));
@@ -224,14 +227,19 @@ EXPORT_SYMBOL_GPL(imx_audmux_v1_configure_port);
224int imx_audmux_v2_configure_port(unsigned int port, unsigned int ptcr, 227int imx_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
225 unsigned int pdcr) 228 unsigned int pdcr)
226{ 229{
230 int ret;
231
227 if (audmux_type != IMX31_AUDMUX) 232 if (audmux_type != IMX31_AUDMUX)
228 return -EINVAL; 233 return -EINVAL;
229 234
230 if (!audmux_base) 235 if (!audmux_base)
231 return -ENOSYS; 236 return -ENOSYS;
232 237
233 if (audmux_clk) 238 if (audmux_clk) {
234 clk_prepare_enable(audmux_clk); 239 ret = clk_prepare_enable(audmux_clk);
240 if (ret)
241 return ret;
242 }
235 243
236 writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port)); 244 writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port));
237 writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port)); 245 writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port));