diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2024-08-22 09:29:53 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2024-08-27 18:11:15 +0300 |
commit | 1d20db6b544a54ff5c8e8ff3237905cb47dc38c6 (patch) | |
tree | b33412dfdd727431b77ad234f948d7292844ab87 | |
parent | bf0b61f0aa99933f29b0424854f18de9435ed5a0 (diff) | |
download | linux-1d20db6b544a54ff5c8e8ff3237905cb47dc38c6.tar.xz |
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: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <20240822062956.3490387-6-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/nct7802.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 5e83504800a3..8c9351da12c6 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -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; - } } } |