diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-10-17 00:45:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-10-18 02:11:45 +0400 |
commit | 2918ad14cc7e16f38206185dbc65f980ffc4ec6c (patch) | |
tree | 72761082944e06b32e2f84fad3c0379f464c7f02 /drivers/staging/iio/adc | |
parent | bf741c08af194ed0448799ff2690c8dd3da709e5 (diff) | |
download | linux-2918ad14cc7e16f38206185dbc65f980ffc4ec6c.tar.xz |
staging:iio:lpc32xx_adc: Fix IRQ check
The test in the lpc32xx_adc driver which checks whether the IRQ number returned
by platform_get_irq() has multiple problems. It accepts 0 even though this is an
invalid IRQ. It also rejects IRQ numbers that are larger or equal than NR_IRQS.
First of all drivers should never need to reference NR_IRQS and secondly with
CONFIG_SPARSE_IRQ NR_IRQS is not the upper limit, so the check might reject
valid IRQ numbers. This patch modifies the check to only test against less or
equal to 0.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Roland Stigge <stigge@antcom.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio/adc')
-rw-r--r-- | drivers/staging/iio/adc/lpc32xx_adc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c index ce7ff3e6cd21..ef0a21d8ce15 100644 --- a/drivers/staging/iio/adc/lpc32xx_adc.c +++ b/drivers/staging/iio/adc/lpc32xx_adc.c @@ -160,7 +160,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev) } irq = platform_get_irq(pdev, 0); - if ((irq < 0) || (irq >= NR_IRQS)) { + if (irq <= 0) { dev_err(&pdev->dev, "failed getting interrupt resource\n"); return -EINVAL; } |