diff mbox series

[-next] pinctrl: sh-pfc: Fix missing unlock on error in sh_pfc_func_set_mux()

Message ID 20190827113527.99831-1-weiyongjun1@huawei.com (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show
Series [-next] pinctrl: sh-pfc: Fix missing unlock on error in sh_pfc_func_set_mux() | expand

Commit Message

Wei Yongjun Aug. 27, 2019, 11:35 a.m. UTC
Add the missing unlock before return from function sh_pfc_func_set_mux()
in the error handling case.

Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pinctrl/sh-pfc/pinctrl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Geert Uytterhoeven Aug. 27, 2019, 11:36 a.m. UTC | #1
On Tue, Aug 27, 2019 at 1:32 PM Wei Yongjun <weiyongjun1@huawei.com> wrote:
> Add the missing unlock before return from function sh_pfc_func_set_mux()
> in the error handling case.
>
> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Thanks, but this is a duplicate of
https://lore.kernel.org/linux-gpio/20190827093927.GB8443@mwanda/

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index 99f4ebd69861..212a4a9c3a8f 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -361,8 +361,10 @@  static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
 		 * This driver cannot manage both gpio and mux when the gpio
 		 * pin is already enabled. So, this function fails.
 		 */
-		if (cfg->gpio_enabled)
-			return -EBUSY;
+		if (cfg->gpio_enabled) {
+			ret = -EBUSY;
+			goto done;
+		}
 
 		ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
 		if (ret < 0)