diff options
| author | YueHaibing <yuehaibing@huawei.com> | 2020-10-31 06:10:53 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-10 14:35:54 +0300 |
| commit | 4ff840604a45673bb02dfaaa5f30cd9bc40011e5 (patch) | |
| tree | 826dd13016eaf1aab3c66407c9988d493f0002f4 | |
| parent | 64752f5cfda61aa7ca12d23ca1ecc7d36e996f93 (diff) | |
| download | linux-4ff840604a45673bb02dfaaa5f30cd9bc40011e5.tar.xz | |
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 <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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/net/phy/sfp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 998d08ae7431..47d518e6d5d4 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; } |
