From: Jiasheng Jiang jiasheng@iscas.ac.cn
stable inclusion from stable-v5.10.89 commit 75c962f02a4ff639caaf1e5f075eb93b4e284972 bugzilla: 186140 https://gitee.com/openeuler/kernel/issues/I4S8HA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
--------------------------------
[ Upstream commit 99d7fbb5cedf598f67e8be106d6c7b8d91366aef ]
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 Signed-off-by: Sasha Levin sashal@kernel.org Signed-off-by: Chen Jun chenjun102@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/net/ethernet/micrel/ks8851_par.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/micrel/ks8851_par.c b/drivers/net/ethernet/micrel/ks8851_par.c index 3bab0cb2b1a5..c7c99cc54ca1 100644 --- a/drivers/net/ethernet/micrel/ks8851_par.c +++ b/drivers/net/ethernet/micrel/ks8851_par.c @@ -323,6 +323,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); }