summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ezchip
diff options
context:
space:
mode:
authorPavel Skripkin <paskripkin@gmail.com>2021-06-18 19:14:47 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-19 11:46:00 -0700
commit0de449d599594f5472e00267d651615c7f2c6c1d (patch)
treee2d92a2b12829bc7c4967e06f7b50d96e91e6654 /drivers/net/ethernet/ezchip
parent4ae85b23e1f052379f0316e42494e2f84f2a3e6f (diff)
downloadlinux-stable-0de449d599594f5472e00267d651615c7f2c6c1d.tar.gz
linux-stable-0de449d599594f5472e00267d651615c7f2c6c1d.tar.bz2
linux-stable-0de449d599594f5472e00267d651615c7f2c6c1d.zip
net: ethernet: ezchip: fix error handling
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: 0dd077093636 ("NET: Add ezchip ethernet driver") Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ezchip')
-rw-r--r--drivers/net/ethernet/ezchip/nps_enet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index c562a1e83913..f9a288a6ec8c 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -607,7 +607,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)
/* Get IRQ number */
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");
err = -ENODEV;
goto out_netdev;