summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2021-12-22 10:41:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-29 14:20:45 +0300
commit01b0153b921a8c48556c17f3ea97a0983e77c174 (patch)
tree9fbace9c2a2f2f8811b9c0b1a533308de393f100
parentdddc12cba9663e4936cb2fff255cdcf4646eb2c9 (diff)
downloadlinux-01b0153b921a8c48556c17f3ea97a0983e77c174.tar.xz
drivers: net: smc911x: Check for error irq
[ Upstream commit cb93b3e11d405f20a405a07482d01147ef4934a3 ] 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: ae150435b59e ("smsc: Move the SMC (SMSC) drivers") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/ethernet/smsc/smc911x.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index f97b35430c84..ac1ad00e2fc5 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -2080,6 +2080,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