Skip to content

Commit

Permalink
staging:iio:spear_adc: Fix IRQ check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Oct 17, 2013
1 parent 2918ad1 commit a47f6e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/iio/adc/spear_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a47f6e0

Please sign in to comment.