summaryrefslogtreecommitdiff
path: root/drivers/hwmon/nct7802.c
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2024-08-22 14:29:53 +0800
committerGuenter Roeck <linux@roeck-us.net>2024-08-27 08:11:15 -0700
commit1d20db6b544a54ff5c8e8ff3237905cb47dc38c6 (patch)
treeb33412dfdd727431b77ad234f948d7292844ab87 /drivers/hwmon/nct7802.c
parentbf0b61f0aa99933f29b0424854f18de9435ed5a0 (diff)
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>
Diffstat (limited to 'drivers/hwmon/nct7802.c')
-rw-r--r--drivers/hwmon/nct7802.c7
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;
- }
}
}