All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq()
@ 2022-04-12  8:51 cgel.zte
  2022-04-12 13:45 ` Linus Walleij
  2022-04-12 22:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-12  8:51 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: linus.walleij, arnd, lv.ruyi, wanjiabing, netdev, linux-kernel,
	Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.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@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq()
  2022-04-12  8:51 [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq() cgel.zte
@ 2022-04-12 13:45 ` Linus Walleij
  2022-04-12 22:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-04-12 13:45 UTC (permalink / raw)
  To: cgel.zte
  Cc: davem, kuba, pabeni, arnd, lv.ruyi, wanjiabing, netdev,
	linux-kernel, Zeal Robot

On Tue, Apr 12, 2022 at 10:51 AM <cgel.zte@gmail.com> wrote:

> From: Lv Ruyi <lv.ruyi@zte.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@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq()
  2022-04-12  8:51 [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq() cgel.zte
  2022-04-12 13:45 ` Linus Walleij
@ 2022-04-12 22:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-12 22:10 UTC (permalink / raw)
  To: CGEL
  Cc: davem, kuba, pabeni, linus.walleij, arnd, lv.ruyi, wanjiabing,
	netdev, linux-kernel, zealci

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 12 Apr 2022 08:51:26 +0000 you wrote:
> From: Lv Ruyi <lv.ruyi@zte.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@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> [...]

Here is the summary with links:
  - ixp4xx_eth: fix error check return value of platform_get_irq()
    https://git.kernel.org/netdev/net-next/c/f45ba67eb74a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-12 23:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12  8:51 [PATCH] ixp4xx_eth: fix error check return value of platform_get_irq() cgel.zte
2022-04-12 13:45 ` Linus Walleij
2022-04-12 22:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.