[PATCH 40/78] ASoC: codecs: peb2466: Use guard() for mutex locks

From: phucduc . bui

Date: Wed Jun 17 2026 - 06:47:46 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/peb2466.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/peb2466.c b/sound/soc/codecs/peb2466.c
index 2d71d204d8fa..ddbc5f34b08a 100644
--- a/sound/soc/codecs/peb2466.c
+++ b/sound/soc/codecs/peb2466.c
@@ -1704,13 +1704,11 @@ static int peb2466_chip_gpio_update_bits(struct peb2466 *peb2466, unsigned int x
* So, a specific cache value is used.
*/

- mutex_lock(&peb2466->gpio.lock);
+ guard(mutex)(&peb2466->gpio.lock);

cache = peb2466_chip_gpio_get_cache(peb2466, xr_reg);
- if (!cache) {
- ret = -EINVAL;
- goto end;
- }
+ if (!cache)
+ return -EINVAL;

tmp = *cache;
tmp &= ~mask;
@@ -1718,14 +1716,11 @@ static int peb2466_chip_gpio_update_bits(struct peb2466 *peb2466, unsigned int x

ret = regmap_write(peb2466->regmap, xr_reg, tmp);
if (ret)
- goto end;
+ return ret;

*cache = tmp;
- ret = 0;

-end:
- mutex_unlock(&peb2466->gpio.lock);
- return ret;
+ return 0;
}

static int peb2466_chip_gpio_set(struct gpio_chip *c, unsigned int offset,
--
2.43.0