Commit 708adef8 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Linus Walleij
Browse files

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



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

Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: default avatarLinus Walleij <linusw@kernel.org>
parent 6fe3b96b
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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;
}