Signed-off-by: Axel Lin <[email protected]>
---
 drivers/gpio/gpio-mb86s7x.c | 5 +++++
 1 file changed, 5 insertions(+)

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));
 
-- 
1.9.1



--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to