diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2024-08-22 14:29:55 +0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2024-08-27 08:11:15 -0700 |
commit | a6e0a54aa7ad58c6b6ff0d4194b985e15fe1c1b2 (patch) | |
tree | 732e899e872590f65006ad219d2959ee6c6a7ce6 /drivers/hwmon/tmp421.c | |
parent | 1b79bcace44b1f4aea798db589cb6052e902dc66 (diff) | |
download | linux-a6e0a54aa7ad58c6b6ff0d4194b985e15fe1c1b2.tar.gz linux-a6e0a54aa7ad58c6b6ff0d4194b985e15fe1c1b2.tar.bz2 linux-a6e0a54aa7ad58c6b6ff0d4194b985e15fe1c1b2.zip |
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>
Diffstat (limited to 'drivers/hwmon/tmp421.c')
-rw-r--r-- | drivers/hwmon/tmp421.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 7a6f9532e594..9537727aad9a 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -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; |