Thread (12 messages) 12 messages, 3 authors, 2024-08-27
STALE699d

[PATCH -next 8/8] hwmon: (tmp464): Simplify with scoped for each OF child loop

From: Jinjie Ruan <hidden>
Date: 2024-08-22 06:30:08
Also in: linux-aspeed, linux-hwmon
Subsystem: hardware monitoring, the rest · Maintainers: Guenter Roeck, Linus Torvalds

Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <redacted>
---
 drivers/hwmon/tmp464.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/tmp464.c b/drivers/hwmon/tmp464.c
index 0a7c0448835b..0f629c6d7695 100644
--- a/drivers/hwmon/tmp464.c
+++ b/drivers/hwmon/tmp464.c
@@ -562,18 +562,15 @@ static int tmp464_probe_child_from_dt(struct device *dev,
 static int tmp464_probe_from_dt(struct device *dev, struct tmp464_data *data)
 {
 	const struct device_node *np = dev->of_node;
-	struct device_node *child;
 	int err;
 
-	for_each_child_of_node(np, child) {
+	for_each_child_of_node_scoped(np, child) {
 		if (strcmp(child->name, "channel"))
 			continue;
 
 		err = tmp464_probe_child_from_dt(dev, child, data);
-		if (err) {
-			of_node_put(child);
+		if (err)
 			return err;
-		}
 	}
 
 	return 0;
-- 
2.34.1

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help