* [patch] gpio: pl061: returning with lock held in pl061_irq_type()
@ 2015-10-08 7:12 Dan Carpenter
2015-10-15 14:45 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-08 7:12 UTC (permalink / raw)
To: Linus Walleij; +Cc: Alexandre Courbot, linux-gpio, kernel-janitors
We were returning with "chip->lock" held by mistake. It's safe to
move the return to before we take the spinlock.
Fixes: 1dbf7f299f90 ('gpio: pl061: detail IRQ trigger handling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 5b1461f..1793397 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -152,12 +152,6 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
if (offset < 0 || offset >= PL061_GPIO_NR)
return -EINVAL;
- spin_lock_irqsave(&chip->lock, flags);
-
- gpioiev = readb(chip->base + GPIOIEV);
- gpiois = readb(chip->base + GPIOIS);
- gpioibe = readb(chip->base + GPIOIBE);
-
if ((trigger & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) &&
(trigger & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)))
{
@@ -168,6 +162,13 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
return -EINVAL;
}
+
+ spin_lock_irqsave(&chip->lock, flags);
+
+ gpioiev = readb(chip->base + GPIOIEV);
+ gpiois = readb(chip->base + GPIOIS);
+ gpioibe = readb(chip->base + GPIOIBE);
+
if (trigger & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
bool polarity = trigger & IRQ_TYPE_LEVEL_HIGH;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] gpio: pl061: returning with lock held in pl061_irq_type()
2015-10-08 7:12 [patch] gpio: pl061: returning with lock held in pl061_irq_type() Dan Carpenter
@ 2015-10-15 14:45 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2015-10-15 14:45 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexandre Courbot, linux-gpio@vger.kernel.org, kernel-janitors
On Thu, Oct 8, 2015 at 9:12 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We were returning with "chip->lock" held by mistake. It's safe to
> move the return to before we take the spinlock.
>
> Fixes: 1dbf7f299f90 ('gpio: pl061: detail IRQ trigger handling')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-15 14:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 7:12 [patch] gpio: pl061: returning with lock held in pl061_irq_type() Dan Carpenter
2015-10-15 14:45 ` 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).