pcmcia: soc_common: ignore invalid interrupts
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 31 Aug 2016 10:17:50 +0000 (11:17 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 22 Sep 2016 08:38:57 +0000 (09:38 +0100)
If gpiod_to_irq() returns an invalid interrupt, we should not try to use
it as an interrupt number.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
drivers/pcmcia/soc_common.c

index e07d84a69fccc144dd53a77833f9c16d7b271649..e499c2b8d7df5a7b2b4bc316bf66f6cf6b3b868b 100644 (file)
@@ -179,10 +179,12 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
                if (skt->stat[i].desc) {
                        int irq = gpiod_to_irq(skt->stat[i].desc);
 
-                       if (i == SOC_STAT_RDY)
-                               skt->socket.pci_irq = irq;
-                       else
-                               skt->stat[i].irq = irq;
+                       if (irq > 0) {
+                               if (i == SOC_STAT_RDY)
+                                       skt->socket.pci_irq = irq;
+                               else
+                                       skt->stat[i].irq = irq;
+                       }
                }
 
                if (skt->stat[i].irq) {