]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mfd: Proper pcf50633 irq check
authorDan Carpenter <error27@gmail.com>
Sun, 28 Mar 2010 11:28:08 +0000 (14:28 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 27 May 2010 23:37:32 +0000 (01:37 +0200)
"pcf->irq_handler" has PCF50633_NUM_IRQ elements.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/pcf50633-core.c

index 710e417e0eeceae30e62d62ba9e3ce11fb6bbf9e..5439282804cc58890cd729398e252af45a572268 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);