From: YueHaibing Date: Sat, 31 Oct 2020 03:10:53 +0000 (+0800) Subject: sfp: Fix error handing in sfp_probe() X-Git-Tag: v4.19.156~61 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4ff840604a45673bb02dfaaa5f30cd9bc40011e5;p=users%2Fdwmw2%2Flinux.git sfp: Fix error handing in sfp_probe() [ Upstream commit 9621618130bf7e83635367c13b9a6ee53935bb37 ] 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 Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20201031031053.25264-1-yuehaibing@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 998d08ae7431a..47d518e6d5d4f 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1886,7 +1886,8 @@ static int sfp_probe(struct platform_device *pdev) continue; irq = gpiod_to_irq(sfp->gpio[i]); - if (!irq) { + if (irq < 0) { + irq = 0; poll = true; continue; }