summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Zhen <zhen1.chen@samsung.com>2014-04-09 12:50:46 (GMT)
committerSylwester Nawrocki <s.nawrocki@samsung.com>2014-04-17 18:35:27 (GMT)
commitc2641847f1680bdcab5e850035c4e7b40db42160 (patch)
tree78d2dd5e12746e2db096a1c07a166178f32739e0
parent129570387cf205fc399fea3ec7ddc44993aea4e9 (diff)
downloadlinux-3.10-c2641847f1680bdcab5e850035c4e7b40db42160.zip
linux-3.10-c2641847f1680bdcab5e850035c4e7b40db42160.tar.gz
linux-3.10-c2641847f1680bdcab5e850035c4e7b40db42160.tar.bz2
ASoC: Samsung: correct code in order to get op_clkrefs/changes/63/19263/5
when i2s->op_clk is NULL we should do clk_get() before clk_get_rate() call , rather than calling clk_get_rate() on NULL clk, which will returns 0. Change-Id: Ic82be597d8e4c27dd670d8d56630c3572e8f7d73 Signed-off-by: Chen Zhen <zhen1.chen@samsung.com>
-rw-r--r--sound/soc/samsung/i2s.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index e1d976e..31936ac 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -471,7 +471,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
i2s->op_clk = clk_get(&i2s->pdev->dev,
"i2s_opclk0");
- if (!WARN_ON(IS_ERR(i2s->op_clk)))
+ if (WARN_ON(IS_ERR(i2s->op_clk)))
return -EINVAL;
clk_prepare_enable(i2s->op_clk);
@@ -1029,7 +1029,7 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
if (i2s->quirks & QUIRK_NEED_RSTCLR)
writel(0, i2s->addr + I2SCON);
- if (i2s->op_clk) {
+ if (!IS_ERR(i2s->op_clk)){
clk_disable_unprepare(i2s->op_clk);
clk_put(i2s->op_clk);
}
@@ -1173,7 +1173,8 @@ static int i2s_runtime_suspend(struct device *dev)
{
struct i2s_dai *i2s = dev_get_drvdata(dev);
- clk_disable_unprepare(i2s->op_clk);
+ if (!IS_ERR(i2s->op_clk))
+ clk_disable_unprepare(i2s->op_clk);
return 0;
}
@@ -1182,7 +1183,8 @@ static int i2s_runtime_resume(struct device *dev)
{
struct i2s_dai *i2s = dev_get_drvdata(dev);
- clk_prepare_enable(i2s->op_clk);
+ if (!IS_ERR(i2s->op_clk))
+ clk_prepare_enable(i2s->op_clk);
return 0;
}
@@ -1295,6 +1297,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
pri_dai->dma_capture.dma_size = 4;
pri_dai->base = regs_base;
pri_dai->quirks = quirks;
+ pri_dai->op_clk = ERR_PTR(-EINVAL);
if (quirks & QUIRK_PRI_6CHAN)
pri_dai->i2s_dai_drv.playback.channels_max = 6;