diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2024-08-22 14:29:52 +0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2024-08-27 08:11:15 -0700 |
commit | bf0b61f0aa99933f29b0424854f18de9435ed5a0 (patch) | |
tree | 61964c778862a1dd96f28b4afec84be8cad6bb88 /drivers/hwmon/lm90.c | |
parent | 3fd38c6434ce54e09d8c3fbd2daf67b9672a65d6 (diff) |
hwmon: (lm90): 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-5-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r-- | drivers/hwmon/lm90.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index ca5c52b38c0f..511d95a0efb3 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2674,19 +2674,16 @@ static int lm90_parse_dt_channel_info(struct i2c_client *client, struct lm90_data *data) { int err; - struct device_node *child; struct device *dev = &client->dev; const struct device_node *np = dev->of_node; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (strcmp(child->name, "channel")) continue; err = lm90_probe_channel_from_dt(client, child, data); - if (err) { - of_node_put(child); + if (err) return err; - } } return 0; |