[PATCH 53/78] ASoC: codecs: sta350: Use guard() for mutex locks
phucduc.bui at gmail.com
phucduc.bui at gmail.com
Wed Jun 17 03:32:10 PDT 2026
From: bui duc phuc <phucduc.bui at gmail.com>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---
sound/soc/codecs/sta350.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/sta350.c b/sound/soc/codecs/sta350.c
index 99c7f7ac807b..b1e2f346c647 100644
--- a/sound/soc/codecs/sta350.c
+++ b/sound/soc/codecs/sta350.c
@@ -306,9 +306,9 @@ static int sta350_coefficient_get(struct snd_kcontrol *kcontrol,
int numcoef = kcontrol->private_value >> 16;
int index = kcontrol->private_value & 0xffff;
unsigned int cfud, val;
- int i, ret = 0;
+ int i;
- mutex_lock(&sta350->coeff_lock);
+ guard(mutex)(&sta350->coeff_lock);
/* preserve reserved bits in STA350_CFUD */
regmap_read(sta350->regmap, STA350_CFUD, &cfud);
@@ -325,8 +325,7 @@ static int sta350_coefficient_get(struct snd_kcontrol *kcontrol,
} else if (numcoef == 5) {
regmap_write(sta350->regmap, STA350_CFUD, cfud | 0x08);
} else {
- ret = -EINVAL;
- goto exit_unlock;
+ return -EINVAL;
}
for (i = 0; i < 3 * numcoef; i++) {
@@ -334,10 +333,7 @@ static int sta350_coefficient_get(struct snd_kcontrol *kcontrol,
ucontrol->value.bytes.data[i] = val;
}
-exit_unlock:
- mutex_unlock(&sta350->coeff_lock);
-
- return ret;
+ return 0;
}
static int sta350_coefficient_put(struct snd_kcontrol *kcontrol,
--
2.43.0
More information about the linux-arm-kernel
mailing list