net: ks8851: Check for error irq
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 22 Dec 2021 07:59:44 +0000 (15:59 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Dec 2021 10:23:50 +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: 797047f875b5 ("net: ks8851: Implement Parallel bus operations")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/micrel/ks8851_par.c

index 2e25798c610eed8f167710d53673504c00eff660..7f49042484bdcebd05def5bfd8be8956cb3d13df 100644 (file)
@@ -321,6 +321,8 @@ static int ks8851_probe_par(struct platform_device *pdev)
                return ret;
 
        netdev->irq = platform_get_irq(pdev, 0);
+       if (netdev->irq < 0)
+               return netdev->irq;
 
        return ks8851_probe_common(netdev, dev, msg_enable);
 }