[RFT] gpio: mb86s70: Return error if requesting an already assigned gpio
diff mbox

Message ID 1422613585.24393.1.camel@phoenix
State New
Headers show

Commit Message

Axel Lin Jan. 30, 2015, 10:26 a.m. UTC
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/gpio-mb86s7x.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Linus Walleij March 2, 2015, 2:36 p.m. UTC | #1
On Fri, Jan 30, 2015 at 11:26 AM, Axel Lin <axel.lin@ingics.com> wrote:

> Signed-off-by: Axel Lin <axel.lin@ingics.com>

No answer for a month. Patch applied, let's see if
someone reacts now.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

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