Thread (28 messages) 28 messages, 7 authors, 2025-06-10
STALE364d

[PATCH 7/9] net: dsa: hellcreek: Use of_find_node_by_name_balanced() to find device_node

From: Zhang Zekun <hidden>
Date: 2025-02-07 01:39:55
Also in: arm-scmi, linux-devicetree, linux-media, linuxppc-dev
Subsystem: hirschmann hellcreek ethernet switch driver, networking drivers, networking [dsa], the rest · Maintainers: Kurt Kanzenbach, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Linus Torvalds

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 <redacted>
---
 drivers/net/dsa/hirschmann/hellcreek_ptp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
index bfe21f9f7dcd..360ceb6831ed 100644
--- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c
+++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
@@ -307,8 +307,7 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek)
 	const char *label;
 	int ret = -EINVAL;
 
-	of_node_get(hellcreek->dev->of_node);
-	leds = of_find_node_by_name(hellcreek->dev->of_node, "leds");
+	leds = of_find_node_by_name_balanced(hellcreek->dev->of_node, "leds");
 	if (!leds) {
 		dev_err(hellcreek->dev, "No LEDs specified in device tree!\n");
 		return ret;
-- 
2.22.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help