Skip to contentSkip to conversation

net: phy: phylink: Don't release NULL GPIO

PATCH Applied Florian Fainelli 3 participants 3 messages May 21, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: phylink: Don't release NULL GPIO

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")
---
 drivers/net/phy/phylink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
index 581ce93ecaf9..af4dc4425be2 100644
@@ -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);
Signature · 1 line
2.14.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Florian Fainelli

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")

Andrew

maintainer Applied
#2 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Sun, 20 May 2018 20:49:47 -0700

Quoted 6 lines

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")

Applied.