mfd: Proper pcf50633 irq check
[safe/jmp/linux-2.6] / drivers / mfd / pcf50633-core.c
index 710e417..5439282 100644 (file)
@@ -218,7 +218,7 @@ static struct attribute_group pcf_attr_group = {
 int pcf50633_register_irq(struct pcf50633 *pcf, int irq,
                        void (*handler) (int, void *), void *data)
 {
-       if (irq < 0 || irq > PCF50633_NUM_IRQ || !handler)
+       if (irq < 0 || irq >= PCF50633_NUM_IRQ || !handler)
                return -EINVAL;
 
        if (WARN_ON(pcf->irq_handler[irq].handler))
@@ -235,7 +235,7 @@ EXPORT_SYMBOL_GPL(pcf50633_register_irq);
 
 int pcf50633_free_irq(struct pcf50633 *pcf, int irq)
 {
-       if (irq < 0 || irq > PCF50633_NUM_IRQ)
+       if (irq < 0 || irq >= PCF50633_NUM_IRQ)
                return -EINVAL;
 
        mutex_lock(&pcf->lock);