Skip to contentSkip to conversation

net: phy: fixed_phy: fix missing calls to gpiod_put in fixed_mdio_bus_exit

PATCH Superseded Heiner Kallweit 1 participant 1 message Aug 26, 2025

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH v2 1/1 net: phy: fixed_phy: fix missing calls to gpiod_put in fixed_mdio_bus_exit

Cleanup in fixed_mdio_bus_exit() misses to call gpiod_put(). Easiest fix is to call fixed_phy_del() for each possible phy address. This may consume a few cpu cycles more, but is much easier to read.

Fixes a5597008dbc2 ("phy: fixed_phy: Add gpio to determine link up/down.")

---
v2:
- rebase for net

---
 drivers/net/phy/fixed_phy.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/phy/fixed_phy.c +2 -6
index 033656d57..a1db96944 100644
@@ -352,17 +352,13 @@ module_init(fixed_mdio_bus_init);
 static void __exit fixed_mdio_bus_exit(void)
 {
 	struct fixed_mdio_bus *fmb = &platform_fmb;
-	struct fixed_phy *fp, *tmp;
 
 	mdiobus_unregister(fmb->mii_bus);
 	mdiobus_free(fmb->mii_bus);
 	faux_device_destroy(fdev);
 
-	list_for_each_entry_safe(fp, tmp, &fmb->phys, node) {
-		list_del(&fp->node);
-		kfree(fp);
-	}
-	ida_destroy(&phy_fixed_ida);
+	for (int i = 0; i < PHY_MAX_ADDR; i++)
+		fixed_phy_del(i);
 }
 module_exit(fixed_mdio_bus_exit);
 
Signature · 1 line
2.50.1