Commit d5733a93 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Guenter Roeck

hwmon: (aspeed-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-3-ruanjinjie@huawei.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 24b070d7
...@@ -907,7 +907,7 @@ static void aspeed_pwm_tacho_remove(void *data) ...@@ -907,7 +907,7 @@ static void aspeed_pwm_tacho_remove(void *data)
static int aspeed_pwm_tacho_probe(struct platform_device *pdev) static int aspeed_pwm_tacho_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np, *child; struct device_node *np;
struct aspeed_pwm_tacho_data *priv; struct aspeed_pwm_tacho_data *priv;
void __iomem *regs; void __iomem *regs;
struct device *hwmon; struct device *hwmon;
...@@ -951,13 +951,11 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) ...@@ -951,13 +951,11 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev)
aspeed_create_type(priv); aspeed_create_type(priv);
for_each_child_of_node(np, child) { for_each_child_of_node_scoped(np, child) {
ret = aspeed_create_fan(dev, child, priv); ret = aspeed_create_fan(dev, child, priv);
if (ret) { if (ret)
of_node_put(child);
return ret; return ret;
} }
}
priv->groups[0] = &pwm_dev_group; priv->groups[0] = &pwm_dev_group;
priv->groups[1] = &fan_dev_group; priv->groups[1] = &fan_dev_group;
......
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