Skip to content

Commit

Permalink
ASoC: fsl_sai: Keep symmetry for clk_enable() and clk_disable()
Browse files Browse the repository at this point in the history
There are two functions haven't clk_disable_unprepare() if having error.
Thus fix them.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Nicolin Chen authored and Mark Brown committed Dec 21, 2013
1 parent dd9f406 commit 1fb2d9d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sound/soc/fsl/fsl_sai.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static int fsl_sai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
dev_err(cpu_dai->dev,
"Cannot set SAI's transmitter sysclk: %d\n",
ret);
return ret;
goto err_clk;
}

ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq,
Expand All @@ -120,12 +120,13 @@ static int fsl_sai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
dev_err(cpu_dai->dev,
"Cannot set SAI's receiver sysclk: %d\n",
ret);
return ret;
goto err_clk;
}

err_clk:
clk_disable_unprepare(sai->clk);

return 0;
return ret;
}

static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
Expand Down Expand Up @@ -222,20 +223,21 @@ static int fsl_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
dev_err(cpu_dai->dev,
"Cannot set SAI's transmitter format: %d\n",
ret);
return ret;
goto err_clk;
}

ret = fsl_sai_set_dai_fmt_tr(cpu_dai, fmt, FSL_FMT_RECEIVER);
if (ret) {
dev_err(cpu_dai->dev,
"Cannot set SAI's receiver format: %d\n",
ret);
return ret;
goto err_clk;
}

err_clk:
clk_disable_unprepare(sai->clk);

return 0;
return ret;
}

static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
Expand Down

0 comments on commit 1fb2d9d

Please sign in to comment.