diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-01-30 18:26:25 +0800 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-03-02 15:35:41 +0100 |
commit | fd9c963c5661af3403e77e312c0d9941773b6c1b (patch) | |
tree | f13369d51a26c11dcbefd074512564841bc9c6bf /drivers/gpio/gpio-mb86s7x.c | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) | |
download | blackbird-op-linux-fd9c963c5661af3403e77e312c0d9941773b6c1b.tar.gz blackbird-op-linux-fd9c963c5661af3403e77e312c0d9941773b6c1b.zip |
gpio: mb86s70: Return error if requesting an already assigned gpio
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mb86s7x.c')
-rw-r--r-- | drivers/gpio/gpio-mb86s7x.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 21b1ce5abdfe..ee93c0ab0a59 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -58,6 +58,11 @@ static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio) spin_lock_irqsave(&gchip->lock, flags); val = readl(gchip->base + PFR(gpio)); + if (!(val & OFFSET(gpio))) { + spin_unlock_irqrestore(&gchip->lock, flags); + return -EINVAL; + } + val &= ~OFFSET(gpio); writel(val, gchip->base + PFR(gpio)); |