netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 net] net: phy: fixed_phy: fix missing calls to gpiod_put in fixed_mdio_bus_exit
@ 2025-08-27 21:02 Heiner Kallweit
  2025-08-27 21:09 ` Russell King (Oracle)
  2025-08-28 10:31 ` Heiner Kallweit
  0 siblings, 2 replies; 8+ messages in thread
From: Heiner Kallweit @ 2025-08-27 21:02 UTC (permalink / raw)
  To: Andrew Lunn, Andrew Lunn, Russell King - ARM Linux,
	Jakub Kicinski, Paolo Abeni, Eric Dumazet, David Miller
  Cc: netdev@vger.kernel.org, Florian Fainelli

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.")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- rebase for net
v3:
- add missing blamed author
---
 drivers/net/phy/fixed_phy.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 033656d57..a1db96944 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -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);
 
-- 
2.50.1





^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-08-28 10:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 21:02 [PATCH v3 net] net: phy: fixed_phy: fix missing calls to gpiod_put in fixed_mdio_bus_exit Heiner Kallweit
2025-08-27 21:09 ` Russell King (Oracle)
2025-08-27 21:14   ` Florian Fainelli
2025-08-27 21:44     ` Russell King (Oracle)
2025-08-27 22:27       ` Andrew Lunn
2025-08-27 21:29   ` Heiner Kallweit
2025-08-27 21:46     ` Russell King (Oracle)
2025-08-28 10:31 ` Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).