diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2014-05-22 06:10:52 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-05-22 12:57:27 -0400 |
commit | a6aba536ab60274e8f46ae3a5966b81c35f845fa (patch) | |
tree | 8c40db9b1db558a24d1c82f97df606567bb59371 /sound/soc/samsung | |
parent | 1d55417e127985b955e0f87b5dd0c38daaa79cd3 (diff) |
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: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r-- | sound/soc/samsung/i2s.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 07ff3e7cb890..043d98645a54 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -488,7 +488,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, | |||
488 | clk_id = 1; | 488 | clk_id = 1; |
489 | 489 | ||
490 | if (!any_active(i2s)) { | 490 | if (!any_active(i2s)) { |
491 | if (i2s->op_clk) { | 491 | if (i2s->op_clk && !IS_ERR(i2s->op_clk)) { |
492 | if ((clk_id && !(mod & MOD_IMS_SYSMUX)) || | 492 | if ((clk_id && !(mod & MOD_IMS_SYSMUX)) || |
493 | (!clk_id && (mod & MOD_IMS_SYSMUX))) { | 493 | (!clk_id && (mod & MOD_IMS_SYSMUX))) { |
494 | clk_disable_unprepare(i2s->op_clk); | 494 | clk_disable_unprepare(i2s->op_clk); |
@@ -506,6 +506,10 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, | |||
506 | else | 506 | else |
507 | i2s->op_clk = clk_get(&i2s->pdev->dev, | 507 | i2s->op_clk = clk_get(&i2s->pdev->dev, |
508 | "i2s_opclk0"); | 508 | "i2s_opclk0"); |
509 | |||
510 | if (WARN_ON(IS_ERR(i2s->op_clk))) | ||
511 | return PTR_ERR(i2s->op_clk); | ||
512 | |||
509 | clk_prepare_enable(i2s->op_clk); | 513 | clk_prepare_enable(i2s->op_clk); |
510 | i2s->rclk_srcrate = clk_get_rate(i2s->op_clk); | 514 | i2s->rclk_srcrate = clk_get_rate(i2s->op_clk); |
511 | 515 | ||