aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-02-10 13:01:28 -0500
committerMark Brown <broonie@linaro.org>2014-02-11 07:54:28 -0500
commit33529ec94f7cb25f6c98908eefde42a1e8d4e67a (patch)
tree1aaf5d758be7ed04e353e3d6c8a22c3e41804d46 /sound
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
ASoC: fsl_esai: 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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_esai.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index d0c72ed261e7..f55341e52970 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -431,17 +431,26 @@ static int fsl_esai_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
431static int fsl_esai_startup(struct snd_pcm_substream *substream, 431static int fsl_esai_startup(struct snd_pcm_substream *substream,
432 struct snd_soc_dai *dai) 432 struct snd_soc_dai *dai)
433{ 433{
434 int ret;
434 struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai); 435 struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
435 436
436 /* 437 /*
437 * Some platforms might use the same bit to gate all three or two of 438 * Some platforms might use the same bit to gate all three or two of
438 * clocks, so keep all clocks open/close at the same time for safety 439 * clocks, so keep all clocks open/close at the same time for safety
439 */ 440 */
440 clk_prepare_enable(esai_priv->coreclk); 441 ret = clk_prepare_enable(esai_priv->coreclk);
441 if (!IS_ERR(esai_priv->extalclk)) 442 if (ret)
442 clk_prepare_enable(esai_priv->extalclk); 443 return ret;
443 if (!IS_ERR(esai_priv->fsysclk)) 444 if (!IS_ERR(esai_priv->extalclk)) {
444 clk_prepare_enable(esai_priv->fsysclk); 445 ret = clk_prepare_enable(esai_priv->extalclk);
446 if (ret)
447 goto err_extalck;
448 }
449 if (!IS_ERR(esai_priv->fsysclk)) {
450 ret = clk_prepare_enable(esai_priv->fsysclk);
451 if (ret)
452 goto err_fsysclk;
453 }
445 454
446 if (!dai->active) { 455 if (!dai->active) {
447 /* Reset Port C */ 456 /* Reset Port C */
@@ -463,6 +472,14 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
463 } 472 }
464 473
465 return 0; 474 return 0;
475
476err_fsysclk:
477 if (!IS_ERR(esai_priv->extalclk))
478 clk_disable_unprepare(esai_priv->extalclk);
479err_extalck:
480 clk_disable_unprepare(esai_priv->coreclk);
481
482 return ret;
466} 483}
467 484
468static int fsl_esai_hw_params(struct snd_pcm_substream *substream, 485static int fsl_esai_hw_params(struct snd_pcm_substream *substream,