diff mbox series

[6/9] net: dsa: Use of_find_node_by_name_balanced() to find device_node

Message ID 20250207013117.104205-7-zhangzekun11@huawei.com (mailing list archive)
State New
Headers show
Series Add wrapper function of_find_node_by_name_balanced() | expand

Commit Message

zhangzekun (A) Feb. 7, 2025, 1:31 a.m. UTC
Instead of directly using of_node_get() before of_find_node_by_name()
to balance the refcount of the device_node, using wraper function
of_find_node_by_name_balanced() to make code logic a bit simplier.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/net/dsa/bcm_sf2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index fa2bf3fa9019..7567686317f1 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1435,9 +1435,7 @@  static int bcm_sf2_sw_probe(struct platform_device *pdev)
 	set_bit(0, priv->cfp.used);
 	set_bit(0, priv->cfp.unique);
 
-	/* Balance of_node_put() done by of_find_node_by_name() */
-	of_node_get(dn);
-	ports = of_find_node_by_name(dn, "ports");
+	ports = of_find_node_by_name_balanced(dn, "ports");
 	if (ports) {
 		bcm_sf2_identify_ports(priv, ports);
 		of_node_put(ports);