Commit a6aba536 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mark Brown

ASoC: samsung: Handle errors when getting the op_clk clock

Ensure i2s->op_clk is not used when clk_get() for this clock fails.
This prevents working with an incorrectly configured clock in some
conditions.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 1d55417e
...@@ -488,7 +488,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, ...@@ -488,7 +488,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
clk_id = 1; clk_id = 1;
if (!any_active(i2s)) { if (!any_active(i2s)) {
if (i2s->op_clk) { if (i2s->op_clk && !IS_ERR(i2s->op_clk)) {
if ((clk_id && !(mod & MOD_IMS_SYSMUX)) || if ((clk_id && !(mod & MOD_IMS_SYSMUX)) ||
(!clk_id && (mod & MOD_IMS_SYSMUX))) { (!clk_id && (mod & MOD_IMS_SYSMUX))) {
clk_disable_unprepare(i2s->op_clk); clk_disable_unprepare(i2s->op_clk);
...@@ -506,6 +506,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, ...@@ -506,6 +506,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
else else
i2s->op_clk = clk_get(&i2s->pdev->dev, i2s->op_clk = clk_get(&i2s->pdev->dev,
"i2s_opclk0"); "i2s_opclk0");
if (WARN_ON(IS_ERR(i2s->op_clk)))
return PTR_ERR(i2s->op_clk);
clk_prepare_enable(i2s->op_clk); clk_prepare_enable(i2s->op_clk);
i2s->rclk_srcrate = clk_get_rate(i2s->op_clk); i2s->rclk_srcrate = clk_get_rate(i2s->op_clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment