]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pinctrl: microchip-sgpio: Simplify locking with guard()
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Sun, 18 Jan 2026 18:09:29 +0000 (19:09 +0100)
committerLinus Walleij <linusw@kernel.org>
Mon, 19 Jan 2026 00:11:47 +0000 (01:11 +0100)
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>
drivers/pinctrl/pinctrl-microchip-sgpio.c

index b6363f3cdce94efa86c563fe6815a2ff11df1816..7a6cb5f502b0eb513ad434e12b070de3c96d316d 100644 (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;
 }