[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220412085126.2532924-1-lv.ruyi@zte.com.cn>
Date: Tue, 12 Apr 2022 08:51:26 +0000
From: cgel.zte@...il.com
To: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com
Cc: linus.walleij@...aro.org, arnd@...db.de, lv.ruyi@....com.cn,
wanjiabing@...o.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Zeal Robot <zealci@....com.cn>
Subject: [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq()
From: Lv Ruyi <lv.ruyi@....com.cn>
platform_get_irq() return negative value on failure, so null check of
return value is incorrect. Fix it by comparing whether it is less than
zero.
Fixes: 9055a2f59162 ("ixp4xx_eth: make ptp support a platform driver")
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@....com.cn>
---
drivers/net/ethernet/xscale/ptp_ixp46x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/xscale/ptp_ixp46x.c b/drivers/net/ethernet/xscale/ptp_ixp46x.c
index 1f382777aa5a..9abbdb71e629 100644
--- a/drivers/net/ethernet/xscale/ptp_ixp46x.c
+++ b/drivers/net/ethernet/xscale/ptp_ixp46x.c
@@ -271,7 +271,7 @@ static int ptp_ixp_probe(struct platform_device *pdev)
ixp_clock.master_irq = platform_get_irq(pdev, 0);
ixp_clock.slave_irq = platform_get_irq(pdev, 1);
if (IS_ERR(ixp_clock.regs) ||
- !ixp_clock.master_irq || !ixp_clock.slave_irq)
+ ixp_clock.master_irq < 0 || ixp_clock.slave_irq < 0)
return -ENXIO;
ixp_clock.caps = ptp_ixp_caps;
--
2.25.1
Powered by blists - more mailing lists