Commit 1b79bcac authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Guenter Roeck

hwmon: (npcm750-pwm-fan): 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>
Message-ID: <20240822062956.3490387-7-ruanjinjie@huawei.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 1d20db6b
...@@ -927,7 +927,7 @@ static int npcm7xx_en_pwm_fan(struct device *dev, ...@@ -927,7 +927,7 @@ static int npcm7xx_en_pwm_fan(struct device *dev,
static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) static int npcm7xx_pwm_fan_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 npcm7xx_pwm_fan_data *data; struct npcm7xx_pwm_fan_data *data;
struct resource *res; struct resource *res;
struct device *hwmon; struct device *hwmon;
...@@ -1004,11 +1004,10 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) ...@@ -1004,11 +1004,10 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
} }
} }
for_each_child_of_node(np, child) { for_each_child_of_node_scoped(np, child) {
ret = npcm7xx_en_pwm_fan(dev, child, data); ret = npcm7xx_en_pwm_fan(dev, child, data);
if (ret) { if (ret) {
dev_err(dev, "enable pwm and fan failed\n"); dev_err(dev, "enable pwm and fan failed\n");
of_node_put(child);
return ret; return ret;
} }
} }
......
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