diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2024-08-22 08:29:54 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2024-08-27 17:11:15 +0200 |
commit | 1b79bcace44b1f4aea798db589cb6052e902dc66 (patch) | |
tree | 71b3260d9735da92689bc9487cf70e87d9df3401 /drivers/hwmon | |
parent | hwmon: (nct7802): Simplify with scoped for each OF child loop (diff) | |
download | linux-1b79bcace44b1f4aea798db589cb6052e902dc66.tar.xz linux-1b79bcace44b1f4aea798db589cb6052e902dc66.zip |
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: Jinjie Ruan <ruanjinjie@huawei.com>
Message-ID: <20240822062956.3490387-7-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/npcm750-pwm-fan.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index bc8db1dc595d..db3b551828eb 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -927,7 +927,7 @@ static int npcm7xx_en_pwm_fan(struct device *dev, static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np, *child; + struct device_node *np; struct npcm7xx_pwm_fan_data *data; struct resource *res; struct device *hwmon; @@ -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); if (ret) { dev_err(dev, "enable pwm and fan failed\n"); - of_node_put(child); return ret; } } |