[alsa-devel] [PATCH 1/6] ASoC: fsl_sai: Keep symmetry for clk_enable() and clk_disable()

Nicolin Chen Guangyu.Chen at freescale.com
Fri Dec 20 09:41:00 CET 2013


There are two functions haven't clk_disable_unprepare() if having error.
Thus fix them.

Signed-off-by: Nicolin Chen <Guangyu.Chen at freescale.com>
---
 sound/soc/fsl/fsl_sai.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 50a797e..e3e8aa1 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -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,
@@ -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,
@@ -222,7 +223,7 @@ 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);
@@ -230,12 +231,13 @@ 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 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,
-- 
1.8.4




More information about the Alsa-devel mailing list