Skip to content

Commit

Permalink
mfd: Proper pcf50633 irq check
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Dan Carpenter authored and Samuel Ortiz committed May 27, 2010
1 parent 2a0cb35 commit 165bce9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mfd/pcf50633-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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);
Expand Down

0 comments on commit 165bce9

Please sign in to comment.