提交 e6a9a9ae 编写于 作者: P Pavel Skripkin 提交者: Zheng Zengkai

net: ethernet: ezchip: fix error handling

stable inclusion
from stable-5.10.50
commit e72d9e4b980758e4bb18707f3bc26b90d47920c4
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e72d9e4b980758e4bb18707f3bc26b90d47920c4

--------------------------------

[ Upstream commit 0de449d5 ]

As documented at drivers/base/platform.c for platform_get_irq:

 * Gets an IRQ for a platform device and prints an error message if finding the
 * IRQ fails. Device drivers should check the return value for errors so as to
 * not pass a negative integer value to the request_irq() APIs.

So, the driver should check that platform_get_irq() return value
is _negative_, not that it's equal to zero, because -ENXIO (return
value from request_irq() if irq was not found) will
pass this check and it leads to passing negative irq to request_irq()

Fixes: 0dd07709 ("NET: Add ezchip ethernet driver")
Signed-off-by: NPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 5db7fd4a
...@@ -610,7 +610,7 @@ static s32 nps_enet_probe(struct platform_device *pdev) ...@@ -610,7 +610,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)
/* Get IRQ number */ /* Get IRQ number */
priv->irq = platform_get_irq(pdev, 0); priv->irq = platform_get_irq(pdev, 0);
if (!priv->irq) { if (priv->irq < 0) {
dev_err(dev, "failed to retrieve <irq Rx-Tx> value from device tree\n"); dev_err(dev, "failed to retrieve <irq Rx-Tx> value from device tree\n");
err = -ENODEV; err = -ENODEV;
goto out_netdev; goto out_netdev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册