From: Roel Kluin Date: Wed, 16 Dec 2009 00:46:18 +0000 (-0800) Subject: gpio: fix test on unsigned in lnw_irq_type() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4efec6272e8e61fc77132b4d2bae56d61b289956;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git gpio: fix test on unsigned in lnw_irq_type() The wrong test was used, gpio is unsigned and it had an off-by-one. Signed-off-by: Roel Kluin Cc: Alek Du Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c index 4baf3d7d0f8e..6c0ebbdc659e 100644 --- a/drivers/gpio/langwell_gpio.c +++ b/drivers/gpio/langwell_gpio.c @@ -123,7 +123,7 @@ static int lnw_irq_type(unsigned irq, unsigned type) void __iomem *grer = (void __iomem *)(&lnw->reg_base->GRER[reg]); void __iomem *gfer = (void __iomem *)(&lnw->reg_base->GFER[reg]); - if (gpio < 0 || gpio > lnw->chip.ngpio) + if (gpio >= lnw->chip.ngpio) return -EINVAL; spin_lock_irqsave(&lnw->lock, flags); if (type & IRQ_TYPE_EDGE_RISING)