[PATCH] sfp: Fix error handing in sfp_probe()

Subsystems: ethernet phy library, networking drivers, sff/sfp/sfp+ module support, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, Linus Torvalds

STALE2185d LANDED

Status: Landed in mainline as 9621618130bf on 2020-11-03.

3 messages, 3 authors, 2020-11-03 · open the first message on its own page

[PATCH] sfp: Fix error handing in sfp_probe()

From: YueHaibing <hidden>
Date: 2020-10-31 03:11:09

gpiod_to_irq() never return 0, but returns negative in
case of error, check it and set gpio_irq to 0.

Fixes: 73970055450e ("sfp: add SFP module support")
Signed-off-by: YueHaibing <redacted>
---
 drivers/net/phy/sfp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 1d18c10e8f82..34aa196b7465 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2389,7 +2389,8 @@ static int sfp_probe(struct platform_device *pdev)
 			continue;
 
 		sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
-		if (!sfp->gpio_irq[i]) {
+		if (sfp->gpio_irq[i] < 0) {
+			sfp->gpio_irq[i] = 0;
 			sfp->need_poll = true;
 			continue;
 		}
-- 
2.17.1

Re: [PATCH] sfp: Fix error handing in sfp_probe()

From: Andrew Lunn <andrew@lunn.ch>
Date: 2020-10-31 18:56:22

On Sat, Oct 31, 2020 at 11:10:53AM +0800, YueHaibing wrote:
gpiod_to_irq() never return 0, but returns negative in
case of error, check it and set gpio_irq to 0.

Fixes: 73970055450e ("sfp: add SFP module support")
Signed-off-by: YueHaibing <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

Re: [PATCH] sfp: Fix error handing in sfp_probe()

From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-11-03 01:23:18

On Sat, 31 Oct 2020 19:56:05 +0100 Andrew Lunn wrote:
On Sat, Oct 31, 2020 at 11:10:53AM +0800, YueHaibing wrote:
quoted
gpiod_to_irq() never return 0, but returns negative in
case of error, check it and set gpio_irq to 0.

Fixes: 73970055450e ("sfp: add SFP module support")
Signed-off-by: YueHaibing <redacted>  
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Applied, thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help