]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: phy: phylink: Don't release NULL GPIO
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 21 May 2018 03:49:47 +0000 (20:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 May 2018 16:13:05 +0000 (12:13 -0400)
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: daab3349ad1a ("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>
drivers/net/phy/phylink.c

index 581ce93ecaf9a3e2b95daecd8e295e2af5fd602a..af4dc4425be28101dd3e8e53b3327c3ef41f725f 100644 (file)
@@ -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);