Skip to content

Commit

Permalink
net: phy: phylink: Don't release NULL GPIO
Browse files Browse the repository at this point in the history
If CONFIG_GPIOLIB is disabled, gpiod_put() becomes a stub that produces a
warning, this helped identify that we could be attempting to release a NULL
pl->link_gpio GPIO descriptor, so guard against that.

Fixes: daab334 ("net: phy: phylink: Release link GPIO")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed May 21, 2018
1 parent 7ddae24 commit 3bcd477
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ void phylink_destroy(struct phylink *pl)
{
if (pl->sfp_bus)
sfp_unregister_upstream(pl->sfp_bus);
if (!IS_ERR(pl->link_gpio))
if (!IS_ERR_OR_NULL(pl->link_gpio))
gpiod_put(pl->link_gpio);

cancel_work_sync(&pl->resolve);
Expand Down

0 comments on commit 3bcd477

Please sign in to comment.