Skip to content

Commit

Permalink
ixp4xx_eth: fix error check return value of platform_get_irq()
Browse files Browse the repository at this point in the history
[ Upstream commit f45ba67 ]

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: 9055a2f ("ixp4xx_eth: make ptp support a platform driver")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220412085126.2532924-1-lv.ruyi@zte.com.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Lv Ruyi authored and gregkh committed Jun 9, 2022
1 parent e3d2187 commit e4a9162
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/xscale/ptp_ixp46x.c
Expand Up @@ -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;
Expand Down

0 comments on commit e4a9162

Please sign in to comment.