lkml.org 
[lkml]   [2009]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] gpio: Fix test on unsigned in lnw_irq_type()
The wrong test was used, gpio is unsigned.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c
index 5711ce5..0d0cbc0 100644
--- a/drivers/gpio/langwell_gpio.c
+++ b/drivers/gpio/langwell_gpio.c
@@ -123,8 +123,11 @@ 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 (irq < lnw->irq_base || gpio > lnw->chip.ngpio ||
+ reg >= ARRAY_SIZE(lnw->reg_base->GRER)
+ reg >= ARRAY_SIZE(lnw->reg_base->GFER))
return -EINVAL;
+
spin_lock_irqsave(&lnw->lock, flags);
if (type & IRQ_TYPE_EDGE_RISING)
value = readl(grer) | BIT(gpio % 32);

\
 
 \ /
  Last update: 2009-10-12 16:15    [from the cache]
©2003-2011 Jasper Spaans