]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drivers: net: smc911x: Check for error irq
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 22 Dec 2021 07:41:12 +0000 (15:41 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Dec 2021 10:23:03 +0000 (10:23 +0000)
Because platform_get_irq() could fail and return error irq.
Therefore, it might be better to check it if order to avoid the use of
error irq.

Fixes: f90d2ab93db2 ("smsc: Move the SMC (SMSC) drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/smsc/smc911x.c

index 89381f79698552d30858e429687d6a39c5286db0..dd6f69ced4ee31f758681a878b3363a7388b3148 100644 (file)
@@ -2072,6 +2072,11 @@ static int smc911x_drv_probe(struct platform_device *pdev)
 
        ndev->dma = (unsigned char)-1;
        ndev->irq = platform_get_irq(pdev, 0);
+       if (ndev->irq < 0) {
+               ret = ndev->irq;
+               goto release_both;
+       }
+
        lp = netdev_priv(ndev);
        lp->netdev = ndev;
 #ifdef SMC_DYNAMIC_BUS_CONFIG