diff options
author | Dan Carpenter <error27@gmail.com> | 2010-01-05 08:59:06 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-01-18 06:30:26 -0500 |
commit | 6f2af72a2451b7491fba820b1d1b0b91c6a84027 (patch) | |
tree | 2b893aa89ce05e77f9da854bbfdba787f6456a15 | |
parent | 9dffe2a32b0deef52605d50527c0d240b15cabf7 (diff) |
mfd: WM8350 off by one bug
If irq == WM8350_NUM_IRQ that would put us past the end of the array.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/wm8350-irq.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c index c8df547c4747..9025f29e2707 100644 --- a/drivers/mfd/wm8350-irq.c +++ b/drivers/mfd/wm8350-irq.c | |||
@@ -434,7 +434,7 @@ int wm8350_register_irq(struct wm8350 *wm8350, int irq, | |||
434 | irq_handler_t handler, unsigned long flags, | 434 | irq_handler_t handler, unsigned long flags, |
435 | const char *name, void *data) | 435 | const char *name, void *data) |
436 | { | 436 | { |
437 | if (irq < 0 || irq > WM8350_NUM_IRQ || !handler) | 437 | if (irq < 0 || irq >= WM8350_NUM_IRQ || !handler) |
438 | return -EINVAL; | 438 | return -EINVAL; |
439 | 439 | ||
440 | if (wm8350->irq[irq].handler) | 440 | if (wm8350->irq[irq].handler) |
@@ -453,7 +453,7 @@ EXPORT_SYMBOL_GPL(wm8350_register_irq); | |||
453 | 453 | ||
454 | int wm8350_free_irq(struct wm8350 *wm8350, int irq) | 454 | int wm8350_free_irq(struct wm8350 *wm8350, int irq) |
455 | { | 455 | { |
456 | if (irq < 0 || irq > WM8350_NUM_IRQ) | 456 | if (irq < 0 || irq >= WM8350_NUM_IRQ) |
457 | return -EINVAL; | 457 | return -EINVAL; |
458 | 458 | ||
459 | wm8350_mask_irq(wm8350, irq); | 459 | wm8350_mask_irq(wm8350, irq); |