diff options
| author | Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> | 2025-12-24 12:07:03 +0100 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-01-31 07:38:32 -0800 |
| commit | bfd0103be5d85751fc8b7c6c8c7553d71022efe0 (patch) | |
| tree | 2ff881e8c7a4810ede118e1e7c75158f1bef1064 /drivers | |
| parent | d4168cb6ae4f77779c8ceb1edf15b8eae95bdf7f (diff) | |
hwmon: (emc2305) Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20251224110702.61746-4-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hwmon/emc2305.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c index ceae96c07ac4..8f80a39574f3 100644 --- a/drivers/hwmon/emc2305.c +++ b/drivers/hwmon/emc2305.c @@ -605,7 +605,6 @@ static int emc2305_probe(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; struct device *dev = &client->dev; - struct device_node *child; struct emc2305_data *data; struct emc2305_platform_data *pdata; int vendor; @@ -681,12 +680,10 @@ static int emc2305_probe(struct i2c_client *client) /* Parse and check for the available PWM child nodes */ if (pwm_childs > 0) { i = 0; - for_each_child_of_node(dev->of_node, child) { + for_each_child_of_node_scoped(dev->of_node, child) { ret = emc2305_set_single_tz(dev, child, i); - if (ret != 0) { - of_node_put(child); + if (ret != 0) return ret; - } i++; } } else { |
