diff options
author | Chen Zhen <zhen1.chen@samsung.com> | 2014-04-09 20:50:46 +0800 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-05-15 07:28:31 +0200 |
commit | 22734637539f90f5c512bf3291d635c5ac2086ad (patch) | |
tree | 308e5a27a4a7c7a098e64b5890adb9b802754b39 /sound | |
parent | 70426a51627df0a5b2b23695dd39c986e18d3994 (diff) | |
download | linux-3.10-22734637539f90f5c512bf3291d635c5ac2086ad.tar.gz linux-3.10-22734637539f90f5c512bf3291d635c5ac2086ad.tar.bz2 linux-3.10-22734637539f90f5c512bf3291d635c5ac2086ad.zip |
ASoC: Samsung: correct code in order to get op_clk
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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/samsung/i2s.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index e1d976e526b..31936ac089d 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; |