[PATCH] ASoC: soc-pcm: ignore un-needed mutex_unlock() case on soc_pcm_open()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Thu Oct 1 03:32:48 CEST 2020
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
commit 140a4532cdb8c ("ASoC: soc-pcm: add soc_pcm_clean() and call it
from soc_pcm_open/close()") switch to call soc_pcm_clean() on
soc_pcm_open() when rollback case.
But, it uses "goto err" (A) *before* mutex_lock() (B) when error of
snd_soc_pcm_component_pm_runtime_get().
The mutex_unlock() (C) is not needed in such case. This patch fix it.
static int soc_pcm_open(...)
{
...
ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);
if (ret < 0)
(A) goto err;
(B) mutex_lock_nested(...);
...
err:
(C) mutex_unlock(..);
...
}
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
sound/soc/soc-pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 09e8d703a502..5d538520e2cf 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -706,7 +706,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);
if (ret < 0)
- goto err;
+ goto pm_err;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
@@ -786,7 +786,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
snd_soc_runtime_activate(rtd, substream->stream);
err:
mutex_unlock(&rtd->card->pcm_mutex);
-
+pm_err:
if (ret < 0)
soc_pcm_clean(substream, 1);
--
2.25.1
More information about the Alsa-devel
mailing list