Skip to content

Commit 708adef

Browse files
krzklinusw
authored andcommitted
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>
1 parent 6fe3b96 commit 708adef

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pinctrl/pinctrl-microchip-sgpio.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,17 @@ static int sgpio_single_shot(struct sgpio_priv *priv)
264264
* setting.
265265
* After the manual burst, reenable the auto repeat mode again.
266266
*/
267-
mutex_lock(&priv->poll_lock);
267+
guard(mutex)(&priv->poll_lock);
268268
ret = regmap_update_bits(priv->regs, addr, single_shot | auto_repeat,
269269
single_shot);
270270
if (ret)
271-
goto out;
271+
return ret;
272272

273273
ret = regmap_read_poll_timeout(priv->regs, addr, ctrl,
274274
!(ctrl & single_shot), 100, 60000);
275275

276276
/* reenable auto repeat mode even if there was an error */
277277
ret2 = regmap_update_bits(priv->regs, addr, auto_repeat, auto_repeat);
278-
out:
279-
mutex_unlock(&priv->poll_lock);
280278

281279
return ret ?: ret2;
282280
}

0 commit comments

Comments
 (0)