Commit 1d20db6b authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Guenter Roeck

hwmon: (nct7802): 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: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <20240822062956.3490387-6-ruanjinjie@huawei.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent bf0b61f0
......@@ -1129,17 +1129,14 @@ static int nct7802_configure_channels(struct device *dev,
{
/* Enable local temperature sensor by default */
u8 mode_mask = MODE_LTD_EN, mode_val = MODE_LTD_EN;
struct device_node *node;
int err;
if (dev->of_node) {
for_each_child_of_node(dev->of_node, node) {
for_each_child_of_node_scoped(dev->of_node, node) {
err = nct7802_get_channel_config(dev, node, &mode_mask,
&mode_val);
if (err) {
of_node_put(node);
if (err)
return err;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment