mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
hwmon: (tmp421): 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-8-ruanjinjie@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
1b79bcace4
commit
a6e0a54aa7
@ -410,18 +410,15 @@ static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
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 = tmp421_probe_child_from_dt(client, child, data);
|
||||
if (err) {
|
||||
of_node_put(child);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user