net/fec: don't request invalid IRQ
authorLothar Waßmann <LW@KARO-electronics.de>
Wed, 7 Dec 2011 21:59:28 +0000 (21:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Dec 2011 00:51:20 +0000 (19:51 -0500)
prevent calling request_irq() with a known invalid IRQ number and
preserve the return value of the platform_get_irq() function

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec.c

index 7ef408fd322aebe4ef0fdebda2c0b546fd811177..e2b5ce6efa2043fbdc62e693cb9cdffac41df785 100644 (file)
@@ -1575,8 +1575,12 @@ fec_probe(struct platform_device *pdev)
 
        for (i = 0; i < FEC_IRQ_NUM; i++) {
                irq = platform_get_irq(pdev, i);
-               if (i && irq < 0)
-                       break;
+               if (irq < 0) {
+                       if (i)
+                               break;
+                       ret = irq;
+                       goto failed_irq;
+               }
                ret = request_irq(irq, fec_enet_interrupt, IRQF_DISABLED, pdev->name, ndev);
                if (ret) {
                        while (--i >= 0) {