linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sfp: Fix error handing in sfp_probe()
@ 2020-10-31  3:10 YueHaibing
  2020-10-31 18:56 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2020-10-31  3:10 UTC (permalink / raw)
  To: linux, andrew, hkallweit1, davem, kuba; +Cc: netdev, linux-kernel, YueHaibing

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 <yuehaibing@huawei.com>
---
 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


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

* Re: [PATCH] sfp: Fix error handing in sfp_probe()
  2020-10-31  3:10 [PATCH] sfp: Fix error handing in sfp_probe() YueHaibing
@ 2020-10-31 18:56 ` Andrew Lunn
  2020-11-03  1:23   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-10-31 18:56 UTC (permalink / raw)
  To: YueHaibing; +Cc: linux, hkallweit1, davem, kuba, netdev, linux-kernel

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 <yuehaibing@huawei.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] sfp: Fix error handing in sfp_probe()
  2020-10-31 18:56 ` Andrew Lunn
@ 2020-11-03  1:23   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-03  1:23 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: YueHaibing, linux, hkallweit1, davem, netdev, linux-kernel

On Sat, 31 Oct 2020 19:56:05 +0100 Andrew Lunn wrote:
> 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 <yuehaibing@huawei.com>  
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Applied, thanks!

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

end of thread, other threads:[~2020-11-03  1:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31  3:10 [PATCH] sfp: Fix error handing in sfp_probe() YueHaibing
2020-10-31 18:56 ` Andrew Lunn
2020-11-03  1:23   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).