summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-10-16 21:45:00 +0100
committerJonathan Cameron <jic23@kernel.org>2013-10-17 23:14:00 +0100
commita47f6e08edd3fbb915a79f0b4d23cbc7586ef897 (patch)
treeb739df2d93216a29b69fb8ac34fd6baf5dca4145
parent2918ad14cc7e16f38206185dbc65f980ffc4ec6c (diff)
staging:iio:spear_adc: Fix IRQ check
The test in the spear_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: Stefan Roese <sr@denx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/staging/iio/adc/spear_adc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c
index e6555b6d8bcb..970d9edc73b6 100644
--- a/drivers/staging/iio/adc/spear_adc.c
+++ b/drivers/staging/iio/adc/spear_adc.c
@@ -333,7 +333,7 @@ static int spear_adc_probe(struct platform_device *pdev)
}
irq = platform_get_irq(pdev, 0);
- if ((irq < 0) || (irq >= NR_IRQS)) {
+ if (irq <= 0) {
dev_err(dev, "failed getting interrupt resource\n");
ret = -EINVAL;
goto errout3;