diff options
| author | bui duc phuc <phucduc.bui@gmail.com> | 2026-07-31 10:06:41 +0700 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-31 16:31:02 +0100 |
| commit | a4aaef818a0875359bcb70bc45a22edee8916090 (patch) | |
| tree | 9daaf21ab8419e62e2469f8fb8f0c83fe7a40dd9 | |
| parent | e396bb39a7702d69ced88c6e9f014fa1febdc009 (diff) | |
| download | linux-next-a4aaef818a0875359bcb70bc45a22edee8916090.tar.gz linux-next-a4aaef818a0875359bcb70bc45a22edee8916090.zip | |
ASoC: codecs: wm8731: Use guard() for mutex locks
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260731030648.8706-20-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/codecs/wm8731.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index a2f0e2f5c407..ce87280d590d 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -10,6 +10,7 @@ * Based on wm8753.c by Liam Girdwood */ +#include <linux/cleanup.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> @@ -110,22 +111,20 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); unsigned int deemph = ucontrol->value.integer.value[0]; - int ret = 0; if (deemph > 1) return -EINVAL; - mutex_lock(&wm8731->lock); + guard(mutex)(&wm8731->lock); if (wm8731->deemph != deemph) { wm8731->deemph = deemph; wm8731_set_deemph(component); - ret = 1; + return 1; } - mutex_unlock(&wm8731->lock); - return ret; + return 0; } static const DECLARE_TLV_DB_SCALE(in_tlv, -3450, 150, 0); |
