pinctrl: microchip-sgpio: Simplify locking with guard()

Simplify error handling (less gotos) over locks with guard().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2026-01-18 19:09:29 +01:00 committed by Linus Walleij
parent 6fe3b96b05
commit 708adef80c

View file

@ -264,19 +264,17 @@ static int sgpio_single_shot(struct sgpio_priv *priv)
* setting.
* After the manual burst, reenable the auto repeat mode again.
*/
mutex_lock(&priv->poll_lock);
guard(mutex)(&priv->poll_lock);
ret = regmap_update_bits(priv->regs, addr, single_shot | auto_repeat,
single_shot);
if (ret)
goto out;
return ret;
ret = regmap_read_poll_timeout(priv->regs, addr, ctrl,
!(ctrl & single_shot), 100, 60000);
/* reenable auto repeat mode even if there was an error */
ret2 = regmap_update_bits(priv->regs, addr, auto_repeat, auto_repeat);
out:
mutex_unlock(&priv->poll_lock);
return ret ?: ret2;
}