All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] ASoC: tegra: Fix missing clk_disable_unprepare() on error path
@ 2021-06-17 11:30 ` Zou Wei
  0 siblings, 0 replies; 3+ messages in thread
From: Zou Wei @ 2021-06-17 11:30 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, thierry.reding, jonathanh
  Cc: alsa-devel, linux-tegra, linux-kernel, Zou Wei

Fix the missing clk_disable_unprepare() before return
from tegra_machine_hw_params() in the error handling case.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 sound/soc/tegra/tegra_asoc_machine.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
index a53aec3..397f326 100644
--- a/sound/soc/tegra/tegra_asoc_machine.c
+++ b/sound/soc/tegra/tegra_asoc_machine.c
@@ -306,6 +306,7 @@ static int tegra_machine_hw_params(struct snd_pcm_substream *substream,
 
 	err = snd_soc_dai_set_sysclk(codec_dai, clk_id, mclk, SND_SOC_CLOCK_IN);
 	if (err < 0) {
+		clk_disable_unprepare(machine->clk_cdev1);
 		dev_err(card->dev, "codec_dai clock not set: %d\n", err);
 		return err;
 	}
@@ -523,8 +524,10 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
 	}
 
 	err = devm_snd_soc_register_card(dev, card);
-	if (err)
+	if (err) {
+		clk_disable_unprepare(machine->clk_cdev1);
 		return err;
+	}
 
 	return 0;
 }
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH -next] ASoC: tegra: Fix missing clk_disable_unprepare() on error path
@ 2021-06-17 11:30 ` Zou Wei
  0 siblings, 0 replies; 3+ messages in thread
From: Zou Wei @ 2021-06-17 11:30 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, thierry.reding, jonathanh
  Cc: linux-tegra, alsa-devel, linux-kernel, Zou Wei

Fix the missing clk_disable_unprepare() before return
from tegra_machine_hw_params() in the error handling case.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 sound/soc/tegra/tegra_asoc_machine.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
index a53aec3..397f326 100644
--- a/sound/soc/tegra/tegra_asoc_machine.c
+++ b/sound/soc/tegra/tegra_asoc_machine.c
@@ -306,6 +306,7 @@ static int tegra_machine_hw_params(struct snd_pcm_substream *substream,
 
 	err = snd_soc_dai_set_sysclk(codec_dai, clk_id, mclk, SND_SOC_CLOCK_IN);
 	if (err < 0) {
+		clk_disable_unprepare(machine->clk_cdev1);
 		dev_err(card->dev, "codec_dai clock not set: %d\n", err);
 		return err;
 	}
@@ -523,8 +524,10 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
 	}
 
 	err = devm_snd_soc_register_card(dev, card);
-	if (err)
+	if (err) {
+		clk_disable_unprepare(machine->clk_cdev1);
 		return err;
+	}
 
 	return 0;
 }
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] ASoC: tegra: Fix missing clk_disable_unprepare() on error path
  2021-06-17 11:30 ` Zou Wei
  (?)
@ 2021-06-17 12:46 ` Dmitry Osipenko
  -1 siblings, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2021-06-17 12:46 UTC (permalink / raw)
  To: Zou Wei, lgirdwood, broonie, perex, tiwai, thierry.reding, jonathanh
  Cc: linux-tegra, alsa-devel, linux-kernel

17.06.2021 14:30, Zou Wei пишет:
> Fix the missing clk_disable_unprepare() before return
> from tegra_machine_hw_params() in the error handling case.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
>  sound/soc/tegra/tegra_asoc_machine.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
> index a53aec3..397f326 100644
> --- a/sound/soc/tegra/tegra_asoc_machine.c
> +++ b/sound/soc/tegra/tegra_asoc_machine.c
> @@ -306,6 +306,7 @@ static int tegra_machine_hw_params(struct snd_pcm_substream *substream,
>  
>  	err = snd_soc_dai_set_sysclk(codec_dai, clk_id, mclk, SND_SOC_CLOCK_IN);
>  	if (err < 0) {
> +		clk_disable_unprepare(machine->clk_cdev1);

It should be the opposite, the clock must be enabled here and it could
be re-enabled in the other error cases. In practice the chance of those
errors is close to zero, so we don't care about them since we will have
much bigger problems in that case.

>  		dev_err(card->dev, "codec_dai clock not set: %d\n", err);
>  		return err;
>  	}
> @@ -523,8 +524,10 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
>  	}
>  
>  	err = devm_snd_soc_register_card(dev, card);
> -	if (err)
> +	if (err) {
> +		clk_disable_unprepare(machine->clk_cdev1);

We also don't disable clock after removing driver module. This is
intentional because that clock is enabled to workaround obscure bug on
one of devboards that I can't reproduce. Ideally we should should fix
the bug and remove the clk-enable hack. So I'm not sure whether this is
a worthwhile "fix".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-17 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 11:30 [PATCH -next] ASoC: tegra: Fix missing clk_disable_unprepare() on error path Zou Wei
2021-06-17 11:30 ` Zou Wei
2021-06-17 12:46 ` Dmitry Osipenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.