Skip to content

Commit

Permalink
sfp: Fix error handing in sfp_probe()
Browse files Browse the repository at this point in the history
gpiod_to_irq() never return 0, but returns negative in
case of error, check it and set gpio_irq to 0.

Fixes: 7397005 ("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>
  • Loading branch information
YueHaibing authored and Jakub Kicinski committed Nov 3, 2020
1 parent 1d85049 commit 9621618
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/phy/sfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9621618

Please sign in to comment.