summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2020-10-31 11:10:53 +0800
committerJakub Kicinski <kuba@kernel.org>2020-11-02 17:19:59 -0800
commit9621618130bf7e83635367c13b9a6ee53935bb37 (patch)
tree497a8051cd10359ac9e0dd217a15aae3d7801393 /drivers/net/phy
parent1d8504937478fdc2f3ef2174a816fd3302eca882 (diff)
downloadlinux-9621618130bf7e83635367c13b9a6ee53935bb37.tar.bz2
sfp: Fix error handing in sfp_probe()
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> Link: https://lore.kernel.org/r/20201031031053.25264-1-yuehaibing@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/sfp.c3
1 files changed, 2 insertions, 1 deletions
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;
}