ASoC: codecs: peb2466: Use guard() for mutex locks

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

Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260721102600.523199-17-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-07-21 17:25:47 +07:00 committed by Mark Brown
parent f3da3b7f6e
commit f7a116261d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -6,6 +6,7 @@
//
// Author: Herve Codina <herve.codina@bootlin.com>
#include <linux/cleanup.h>
#include <linux/unaligned.h>
#include <linux/clk.h>
#include <linux/firmware.h>
@ -1704,13 +1705,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 +1717,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,