Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <roel.kluin@gmail.com>
Cc: Alek Du <alek.du@intel.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Roel Kluin and committed by
Linus Torvalds
4efec627 afd49a7e

+1 -1
+1 -1
drivers/gpio/langwell_gpio.c
··· 123 123 void __iomem *grer = (void __iomem *)(&lnw->reg_base->GRER[reg]); 124 124 void __iomem *gfer = (void __iomem *)(&lnw->reg_base->GFER[reg]); 125 125 126 - if (gpio < 0 || gpio > lnw->chip.ngpio) 126 + if (gpio >= lnw->chip.ngpio) 127 127 return -EINVAL; 128 128 spin_lock_irqsave(&lnw->lock, flags); 129 129 if (type & IRQ_TYPE_EDGE_RISING)