hwmon: (tmp464): Simplify with scoped for each OF child loop

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

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <20240822062956.3490387-9-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Jinjie Ruan 2024-08-22 14:29:56 +08:00 committed by Guenter Roeck
parent a6e0a54aa7
commit d5b0723286

View File

@ -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;