Skip to content

Commit e2c58cb

Browse files
krzklinusw
authored andcommitted
pinctrl: rockchip: Simplify locking with scoped_guard()
Simplify error handling by removing two mutex_unlock() calls with scoped_guard(). Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
1 parent 160d686 commit e2c58cb

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

drivers/pinctrl/pinctrl-rockchip.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,17 +3640,16 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
36403640
* The lock makes sure that either gpio-probe has completed
36413641
* or the gpio driver hasn't probed yet.
36423642
*/
3643-
mutex_lock(&bank->deferred_lock);
3644-
if (!gpio || !gpio->direction_output) {
3645-
rc = rockchip_pinconf_defer_pin(bank, pin - bank->pin_base, param,
3646-
arg);
3647-
mutex_unlock(&bank->deferred_lock);
3648-
if (rc)
3649-
return rc;
3650-
3651-
break;
3643+
scoped_guard(mutex, &bank->deferred_lock) {
3644+
if (!gpio || !gpio->direction_output) {
3645+
rc = rockchip_pinconf_defer_pin(bank,
3646+
pin - bank->pin_base,
3647+
param, arg);
3648+
if (rc)
3649+
return rc;
3650+
break;
3651+
}
36523652
}
3653-
mutex_unlock(&bank->deferred_lock);
36543653
}
36553654

36563655
switch (param) {

0 commit comments

Comments
 (0)