Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH] gpio: mxc: Unlock on error path in mxc_flip_edge()
@ 2023-01-24 15:20 Dan Carpenter
  2023-01-24 15:27 ` Marek Vasut
  2023-01-25 12:34 ` Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-01-24 15:20 UTC (permalink / raw)
  To: Linus Walleij, Marek Vasut
  Cc: Bartosz Golaszewski, Marc Zyngier, linux-gpio, kernel-janitors

We recently added locking to this function but one error path was
over looked.  Drop the lock before returning.

Fixes: e5464277625c ("gpio: mxc: Protect GPIO irqchip RMW with bgpio spinlock")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/gpio/gpio-mxc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 6f673b2f2a1b..9d0cec4b82a3 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -249,10 +249,11 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
 	} else {
 		pr_err("mxc: invalid configuration for GPIO %d: %x\n",
 		       gpio, edge);
-		return;
+		goto unlock;
 	}
 	writel(val | (edge << (bit << 1)), reg);
 
+unlock:
 	raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
 }
 
-- 
2.35.1


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

* Re: [PATCH] gpio: mxc: Unlock on error path in mxc_flip_edge()
  2023-01-24 15:20 [PATCH] gpio: mxc: Unlock on error path in mxc_flip_edge() Dan Carpenter
@ 2023-01-24 15:27 ` Marek Vasut
  2023-01-25 12:34 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2023-01-24 15:27 UTC (permalink / raw)
  To: Dan Carpenter, Linus Walleij
  Cc: Bartosz Golaszewski, Marc Zyngier, linux-gpio, kernel-janitors

On 1/24/23 16:20, Dan Carpenter wrote:
> We recently added locking to this function but one error path was
> over looked.  Drop the lock before returning.
> 
> Fixes: e5464277625c ("gpio: mxc: Protect GPIO irqchip RMW with bgpio spinlock")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>   drivers/gpio/gpio-mxc.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 6f673b2f2a1b..9d0cec4b82a3 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -249,10 +249,11 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
>   	} else {
>   		pr_err("mxc: invalid configuration for GPIO %d: %x\n",
>   		       gpio, edge);
> -		return;
> +		goto unlock;
>   	}
>   	writel(val | (edge << (bit << 1)), reg);
>   
> +unlock:
>   	raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
>   }

Acked-by: Marek Vasut <marex@denx.de>

Thanks !

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

* Re: [PATCH] gpio: mxc: Unlock on error path in mxc_flip_edge()
  2023-01-24 15:20 [PATCH] gpio: mxc: Unlock on error path in mxc_flip_edge() Dan Carpenter
  2023-01-24 15:27 ` Marek Vasut
@ 2023-01-25 12:34 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2023-01-25 12:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Linus Walleij, Marek Vasut, Marc Zyngier, linux-gpio,
	kernel-janitors

On Tue, Jan 24, 2023 at 4:20 PM Dan Carpenter <error27@gmail.com> wrote:
>
> We recently added locking to this function but one error path was
> over looked.  Drop the lock before returning.
>
> Fixes: e5464277625c ("gpio: mxc: Protect GPIO irqchip RMW with bgpio spinlock")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>  drivers/gpio/gpio-mxc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 6f673b2f2a1b..9d0cec4b82a3 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -249,10 +249,11 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
>         } else {
>                 pr_err("mxc: invalid configuration for GPIO %d: %x\n",
>                        gpio, edge);
> -               return;
> +               goto unlock;
>         }
>         writel(val | (edge << (bit << 1)), reg);
>
> +unlock:
>         raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
>  }
>
> --
> 2.35.1
>

Queued for fixes, thanks!

Bart

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

end of thread, other threads:[~2023-01-25 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-24 15:20 [PATCH] gpio: mxc: Unlock on error path in mxc_flip_edge() Dan Carpenter
2023-01-24 15:27 ` Marek Vasut
2023-01-25 12:34 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox