[PATCH 10/26] ASoC: codecs: twl6040: Use guard() for mutex locks

From: phucduc . bui

Date: Thu Jul 23 2026 - 01:04:14 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.

Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/codecs/twl6040.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index e10c51092a35..650836f9615f 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
+#include <linux/cleanup.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
@@ -273,7 +274,7 @@ static void twl6040_hs_jack_report(struct snd_soc_component *component,
struct twl6040_data *priv = snd_soc_component_get_drvdata(component);
int status;

- mutex_lock(&priv->mutex);
+ guard(mutex)(&priv->mutex);

/* Sync status */
status = twl6040_read(component, TWL6040_REG_STATUS);
@@ -281,8 +282,6 @@ static void twl6040_hs_jack_report(struct snd_soc_component *component,
snd_soc_jack_report(jack, report, report);
else
snd_soc_jack_report(jack, 0, report);
-
- mutex_unlock(&priv->mutex);
}

void twl6040_hs_jack_detect(struct snd_soc_component *component,
--
2.43.0