From: Axel Lin Date: Fri, 30 Jan 2015 10:26:25 +0000 (+0800) Subject: gpio: mb86s70: Return error if requesting an already assigned gpio X-Git-Tag: v4.14-rc1~5555^2~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd9c963c5661af3403e77e312c0d9941773b6c1b;p=platform%2Fkernel%2Flinux-rpi.git gpio: mb86s70: Return error if requesting an already assigned gpio Signed-off-by: Axel Lin Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 21b1ce5..ee93c0a 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));