public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/1] net: mdio: remove redundant fwnode cleanup
@ 2025-11-24 14:50 Buday Csaba
  2025-11-25 23:10 ` Andrew Lunn
  2025-11-26  3:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Buday Csaba @ 2025-11-24 14:50 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: Buday Csaba

Remove redundant fwnode cleanup in of_mdiobus_register_device()
and xpcs_plat_init_dev().

mdio_device_free() eventually calls mdio_device_release(),
which already performs fwnode_handle_put(), making the manual
cleanup unnecessary.

Combine fwnode_handle_get() with device_set_node() in
of_mdiobus_register_device() for clarity.

Signed-off-by: Buday Csaba <buday.csaba@prolan.hu>
---
Previously discussed here:
https://lore.kernel.org/all/c01fc3d0-050e-4ea7-970f-393268430824@lunn.ch/
---
 drivers/net/mdio/of_mdio.c      | 5 +----
 drivers/net/pcs/pcs-xpcs-plat.c | 3 ---
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
index 1357348e0..b8d298c04 100644
--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -63,14 +63,11 @@ static int of_mdiobus_register_device(struct mii_bus *mdio,
 	/* Associate the OF node with the device structure so it
 	 * can be looked up later.
 	 */
-	fwnode_handle_get(fwnode);
-	device_set_node(&mdiodev->dev, fwnode);
+	device_set_node(&mdiodev->dev, fwnode_handle_get(fwnode));
 
 	/* All data is now stored in the mdiodev struct; register it. */
 	rc = mdio_device_register(mdiodev);
 	if (rc) {
-		device_set_node(&mdiodev->dev, NULL);
-		fwnode_handle_put(fwnode);
 		mdio_device_free(mdiodev);
 		return rc;
 	}
diff --git a/drivers/net/pcs/pcs-xpcs-plat.c b/drivers/net/pcs/pcs-xpcs-plat.c
index c422e8d8b..b8c48f9ef 100644
--- a/drivers/net/pcs/pcs-xpcs-plat.c
+++ b/drivers/net/pcs/pcs-xpcs-plat.c
@@ -365,9 +365,6 @@ static int xpcs_plat_init_dev(struct dw_xpcs_plat *pxpcs)
 err_clean_data:
 	mdiodev->dev.platform_data = NULL;
 
-	fwnode_handle_put(dev_fwnode(&mdiodev->dev));
-	device_set_node(&mdiodev->dev, NULL);
-
 	mdio_device_free(mdiodev);
 
 	return ret;

base-commit: e2c20036a8879476c88002730d8a27f4e3c32d4b
-- 
2.39.5



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

* Re: [PATCH net-next 1/1] net: mdio: remove redundant fwnode cleanup
  2025-11-24 14:50 [PATCH net-next 1/1] net: mdio: remove redundant fwnode cleanup Buday Csaba
@ 2025-11-25 23:10 ` Andrew Lunn
  2025-11-26  3:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2025-11-25 23:10 UTC (permalink / raw)
  To: Buday Csaba
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On Mon, Nov 24, 2025 at 03:50:44PM +0100, Buday Csaba wrote:
> Remove redundant fwnode cleanup in of_mdiobus_register_device()
> and xpcs_plat_init_dev().
> 
> mdio_device_free() eventually calls mdio_device_release(),
> which already performs fwnode_handle_put(), making the manual
> cleanup unnecessary.
> 
> Combine fwnode_handle_get() with device_set_node() in
> of_mdiobus_register_device() for clarity.
> 
> Signed-off-by: Buday Csaba <buday.csaba@prolan.hu>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 1/1] net: mdio: remove redundant fwnode cleanup
  2025-11-24 14:50 [PATCH net-next 1/1] net: mdio: remove redundant fwnode cleanup Buday Csaba
  2025-11-25 23:10 ` Andrew Lunn
@ 2025-11-26  3:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-26  3:00 UTC (permalink / raw)
  To: Buday Csaba
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 24 Nov 2025 15:50:44 +0100 you wrote:
> Remove redundant fwnode cleanup in of_mdiobus_register_device()
> and xpcs_plat_init_dev().
> 
> mdio_device_free() eventually calls mdio_device_release(),
> which already performs fwnode_handle_put(), making the manual
> cleanup unnecessary.
> 
> [...]

Here is the summary with links:
  - [net-next,1/1] net: mdio: remove redundant fwnode cleanup
    https://git.kernel.org/netdev/net-next/c/ce28e333d628

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-11-26  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-24 14:50 [PATCH net-next 1/1] net: mdio: remove redundant fwnode cleanup Buday Csaba
2025-11-25 23:10 ` Andrew Lunn
2025-11-26  3:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox