]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: stm: stm32_adfsdm: Use guard() for mutex locks
authorbui duc phuc <phucduc.bui@gmail.com>
Fri, 15 May 2026 11:24:55 +0000 (18:24 +0700)
committerMark Brown <broonie@kernel.org>
Fri, 22 May 2026 12:36:21 +0000 (13:36 +0100)
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260515112458.34378-2-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/stm/stm32_adfsdm.c

index 0f6d32814c222e71df858308a857374a131ef373..a585cb9fc011a678914b33835a6439070de77528 100644 (file)
@@ -62,12 +62,11 @@ static void stm32_adfsdm_shutdown(struct snd_pcm_substream *substream,
 {
        struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
 
-       mutex_lock(&priv->lock);
+       guard(mutex)(&priv->lock);
        if (priv->iio_active) {
                iio_channel_stop_all_cb(priv->iio_cb);
                priv->iio_active = false;
        }
-       mutex_unlock(&priv->lock);
 }
 
 static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
@@ -76,7 +75,7 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
        struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
        int ret;
 
-       mutex_lock(&priv->lock);
+       guard(mutex)(&priv->lock);
        if (priv->iio_active) {
                iio_channel_stop_all_cb(priv->iio_cb);
                priv->iio_active = false;
@@ -88,7 +87,7 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
        if (ret < 0) {
                dev_err(dai->dev, "%s: Failed to set %d sampling rate\n",
                        __func__, substream->runtime->rate);
-               goto out;
+               return ret;
        }
 
        if (!priv->iio_active) {
@@ -100,9 +99,6 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
                                __func__, ret);
        }
 
-out:
-       mutex_unlock(&priv->lock);
-
        return ret;
 }