Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: rockchip: Fix configuring a deferred pin

Commit e2c58cbe3aff ("pinctrl: rockchip: Simplify locking with
scoped_guard()") added a scoped_guard() over existing code containing a
"break" instruction. That "break" was for the outer (existing)
for-loop, which now exits inner, scoped_guard() loop. If GPIO driver
did not probe, then driver will not bail out, but instead continue to
configure the pin.

Fix the issue by simplifying the code - the break in original code was
leading directly to end of the function returning 0, thus we can simply
return here rockchip_pinconf_defer_pin status.

Reported-by: David Lechner <dlechner@baylibre.com>
Closes: https://lore.kernel.org/r/f5b38942-a584-4e78-a893-de4a219070b2@baylibre.com/
Fixes: e2c58cbe3aff ("pinctrl: rockchip: Simplify locking with scoped_guard()")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Linus Walleij
45fe4592 fd5bed79

+4 -8
+4 -8
drivers/pinctrl/pinctrl-rockchip.c
··· 3640 3640 * or the gpio driver hasn't probed yet. 3641 3641 */ 3642 3642 scoped_guard(mutex, &bank->deferred_lock) { 3643 - if (!gpio || !gpio->direction_output) { 3644 - rc = rockchip_pinconf_defer_pin(bank, 3645 - pin - bank->pin_base, 3646 - param, arg); 3647 - if (rc) 3648 - return rc; 3649 - break; 3650 - } 3643 + if (!gpio || !gpio->direction_output) 3644 + return rockchip_pinconf_defer_pin(bank, 3645 + pin - bank->pin_base, 3646 + param, arg); 3651 3647 } 3652 3648 } 3653 3649