net: lan966x: add missing fwnode_handle_put() for ports node
Subsystems (3)
PATCH 1/1 net: lan966x: add missing fwnode_handle_put() for ports node
Since the "ethernet-ports" node is retrieved using device_get_named_child_node(), it should be release after using it. Add missing fwnode_handle_put() and move the code that retrieved the node from device-tree to avoid complicated handling in case of error.
--- .../net/ethernet/microchip/lan966x/lan966x_main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/microchip/lan966x/lan966x_main.c +8 -5
@@ -1043,11 +1043,6 @@ static int lan966x_probe(struct platform_device *pdev) lan966x->base_mac[5 ] &=0xf0 ; } - ports =device_get_named_child_node (&pdev->dev,"ethernet-ports" ); -if (!ports) -return dev_err_probe (&pdev->dev, -ENODEV , -"no ethernet-ports child found\n" ); - err =lan966x_create_targets (pdev, lan966x);if (err) return dev_err_probe(&pdev->dev, err,
@@ -1125,6 +1120,11 @@ static int lan966x_probe(struct platform_device *pdev) } } + ports =device_get_named_child_node (&pdev->dev,"ethernet-ports" ); +if (!ports) +return dev_err_probe (&pdev->dev, -ENODEV , +"no ethernet-ports child found\n" ); +/* init switch */ lan966x_init (lan966x);lan966x_stats_init (lan966x);
@@ -1162,6 +1162,8 @@ static int lan966x_probe(struct platform_device *pdev) goto cleanup_ports; } +fwnode_handle_put (ports); +lan966x_mdb_init (lan966x); err =lan966x_fdb_init (lan966x);if (err)
@@ -1191,6 +1193,7 @@ static int lan966x_probe(struct platform_device *pdev)lan966x_fdb_deinit (lan966x); cleanup_ports: +fwnode_handle_put (ports);fwnode_handle_put (portnp);lan966x_cleanup_ports (lan966x);
Signature · 1 line
2.39.0
Quoted 6 lines · Clément Léger
Since the "ethernet-ports" node is retrieved using
device_get_named_child_node(), it should be release after using it. Add missingfwnode_handle_put()and move the code that retrieved the node from device-tree to avoid complicated handling in case of error.Signed-off-by Clément Léger <[email protected]>
You should probably add a fixes tag to this:
Other than that the patch itself looks good to me.
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 12 Jan 2023 17:13:11 +0100 you wrote:
Since the "ethernet-ports" node is retrieved using
device_get_named_child_node(), it should be release after using it. Add missingfwnode_handle_put()and move the code that retrieved the node from device-tree to avoid complicated handling in case of error.Signed-off-by Clément Léger <[email protected]>[...]
Here is the summary with links:
- [net] net: lan966x: add missing fwnode_handle_put() for ports node
https://git.kernel.org/netdev/net/c/925f3deb45df
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html