Commit 1a705797 authored by Chen Ni's avatar Chen Ni Committed by Mark Brown

ASoC: max98088: Check for clk_prepare_enable() error

clk_prepare_enable() may fail, so we should better check its return
value and propagate it in the case of error.

Fixes: 62a7fc32 ("ASoC: max98088: Add master clock handling")
Signed-off-by: default avatarChen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20240628080534.843815-1-nichen@iscas.ac.cnSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 061505a1
...@@ -1318,6 +1318,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, ...@@ -1318,6 +1318,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component);
int ret;
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -1333,10 +1334,13 @@ static int max98088_set_bias_level(struct snd_soc_component *component, ...@@ -1333,10 +1334,13 @@ static int max98088_set_bias_level(struct snd_soc_component *component,
*/ */
if (!IS_ERR(max98088->mclk)) { if (!IS_ERR(max98088->mclk)) {
if (snd_soc_component_get_bias_level(component) == if (snd_soc_component_get_bias_level(component) ==
SND_SOC_BIAS_ON) SND_SOC_BIAS_ON) {
clk_disable_unprepare(max98088->mclk); clk_disable_unprepare(max98088->mclk);
else } else {
clk_prepare_enable(max98088->mclk); ret = clk_prepare_enable(max98088->mclk);
if (ret)
return ret;
}
} }
break; break;
......
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