spi/imx: correct the test on platform_get_irq() return value
authorRichard Genoud <richard.genoud@gmail.com>
Fri, 7 Jan 2011 14:26:01 +0000 (15:26 +0100)
committerGrant Likely <grant.likely@secretlab.ca>
Fri, 7 Jan 2011 17:01:23 +0000 (10:01 -0700)
The test "if (spi_imx->irq <= 0)" is not testing the IRQ value, but
the return value of platform_get_irq().  As platform_get_irq() can
return an error (-ENXIO) or the IRQ value it found, the test should be
"if (spi_imx->irq < 0)"

[grant.likely: Note: In general, Linux irq number 0 should also mean
no irq, but arm still allows devices to be assigned 0, and the imx
platform uses 0 for one of the spi devices, so this patch is needed
for the device to work]

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/spi/spi_imx.c

index 9010ef0385a8c91ca7791527076bfb87fa64bb85..9469564e6888e3a2715f82c21a330ca98759ec45 100644 (file)
@@ -821,7 +821,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
        }
 
        spi_imx->irq = platform_get_irq(pdev, 0);
-       if (spi_imx->irq <= 0) {
+       if (spi_imx->irq < 0) {
                ret = -EINVAL;
                goto out_iounmap;
        }