summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2024-08-22 09:29:49 +0300
committerGuenter Roeck <linux@roeck-us.net>2024-08-27 18:11:15 +0300
commit24b070d7d8d84f6af7de6057fdf0d80079c7e929 (patch)
tree7f93a6f6a7a4093e706c227ecf71f45662405ec6 /drivers/hwmon
parent4599510091a1d6d4759f1302dff32b24481eec15 (diff)
downloadlinux-24b070d7d8d84f6af7de6057fdf0d80079c7e929.tar.xz
hwmon: (aspeed-g6-pwm-tacho): 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> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> Message-ID: <20240822062956.3490387-2-ruanjinjie@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/aspeed-g6-pwm-tach.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/hwmon/aspeed-g6-pwm-tach.c b/drivers/hwmon/aspeed-g6-pwm-tach.c
index 08a2ded95e45..75eadda738ab 100644
--- a/drivers/hwmon/aspeed-g6-pwm-tach.c
+++ b/drivers/hwmon/aspeed-g6-pwm-tach.c
@@ -456,7 +456,6 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev, *hwmon;
int ret;
- struct device_node *child;
struct aspeed_pwm_tach_data *priv;
struct pwm_chip *chip;
@@ -498,10 +497,9 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev)
if (ret)
return dev_err_probe(dev, ret, "Failed to add PWM chip\n");
- for_each_child_of_node(dev->of_node, child) {
+ for_each_child_of_node_scoped(dev->of_node, child) {
ret = aspeed_create_fan_monitor(dev, child, priv);
if (ret) {
- of_node_put(child);
dev_warn(dev, "Failed to create fan %d", ret);
return 0;
}