Commit 24b070d7 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Guenter Roeck

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: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: default avatarAndrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <20240822062956.3490387-2-ruanjinjie@huawei.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 45995100
......@@ -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;
}
......
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