linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux()
@ 2019-08-27  9:39 Dan Carpenter
  2019-08-27  9:49 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-08-27  9:39 UTC (permalink / raw)
  To: Geert Uytterhoeven, Yoshihiro Shimoda
  Cc: Linus Walleij, linux-renesas-soc, linux-gpio, kernel-janitors

We need to unlock and enable IRQs before we return on this error path.

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

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)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux()
  2019-08-27  9:39 [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux() Dan Carpenter
@ 2019-08-27  9:49 ` Geert Uytterhoeven
  2019-08-27  9:54 ` Yoshihiro Shimoda
  2019-09-12 12:01 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-08-27  9:49 UTC (permalink / raw)
  To: Dan Carpenter, Linus Walleij
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Linux-Renesas,
	open list:GPIO SUBSYSTEM, kernel-janitors

On Tue, Aug 27, 2019 at 11:39 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We need to unlock and enable IRQs before we return on this error path.

Wow, how could we have missed that?!?
Thanks!

> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Linus: As we're already past rc6, I don't plan to send another pull
       request for v5.4.
       Hence can you please take this one directly?
       Thanks!

> --- 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)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux()
  2019-08-27  9:39 [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux() Dan Carpenter
  2019-08-27  9:49 ` Geert Uytterhoeven
@ 2019-08-27  9:54 ` Yoshihiro Shimoda
  2019-09-12 12:01 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2019-08-27  9:54 UTC (permalink / raw)
  To: Dan Carpenter, Geert Uytterhoeven
  Cc: Linus Walleij, linux-renesas-soc, linux-gpio, kernel-janitors

Hi Dan,

> From: Dan Carpenter, Sent: Tuesday, August 27, 2019 6:39 PM
> 
> We need to unlock and enable IRQs before we return on this error path.
> 
> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux()
  2019-08-27  9:39 [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux() Dan Carpenter
  2019-08-27  9:49 ` Geert Uytterhoeven
  2019-08-27  9:54 ` Yoshihiro Shimoda
@ 2019-09-12 12:01 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-09-12 12:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Geert Uytterhoeven, Yoshihiro Shimoda, Linux-Renesas,
	open list:GPIO SUBSYSTEM, kernel-janitors

On Tue, Aug 27, 2019 at 10:39 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> We need to unlock and enable IRQs before we return on this error path.
>
> Fixes: 8a0cc47ccc7c ("pinctrl: sh-pfc: Rollback to mux if required when the gpio is freed")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied for v5.4 with the ACKs.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-12 12:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27  9:39 [PATCH] pinctrl: sh-pfc: Unlock on error in sh_pfc_func_set_mux() Dan Carpenter
2019-08-27  9:49 ` Geert Uytterhoeven
2019-08-27  9:54 ` Yoshihiro Shimoda
2019-09-12 12:01 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).