diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-10-08 09:12:01 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-10-15 16:43:51 +0200 |
commit | 21d4de1469a1da20a14a745c5f49488bba417ea7 (patch) | |
tree | d0c39132649b032b524328ea7d0abf88a4134795 /drivers/gpio | |
parent | Revert "gpio-sysfs: Use gpio descriptor name instead of gpiochip names array" (diff) | |
download | linux-21d4de1469a1da20a14a745c5f49488bba417ea7.tar.xz linux-21d4de1469a1da20a14a745c5f49488bba417ea7.zip |
gpio: pl061: returning with lock held in pl061_irq_type()
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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pl061.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 5b1461f6aeed..179339739d60 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; |