gpio: pl061: returning with lock held in pl061_irq_type()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 8 Oct 2015 07:12:01 +0000 (10:12 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 15 Oct 2015 14:43:51 +0000 (16:43 +0200)
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>
drivers/gpio/gpio-pl061.c

index 5b1461f6aeedf34ba9aba30182a761606f197f27..179339739d603dc63238f0d1a3da261dbff320b9 100644 (file)
@@ -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;