summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-10-10 20:06:20 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-11-26 13:28:43 +0100
commit4dc00afc20ddb676aedc0ab776397c99e4025e30 (patch)
tree3dc12965eaa03e48b82f39b81a667efe1d92f3a5
parent8309135a39de73af2b4bbaa8385e40ffccbfc42c (diff)
downloadlwn-4dc00afc20ddb676aedc0ab776397c99e4025e30.tar.gz
lwn-4dc00afc20ddb676aedc0ab776397c99e4025e30.zip
thermal: qcom-spmi-adc-tm5: Simplify with scoped for each OF child loop
Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20241010-b4-cleanup-h-of-node-put-thermal-v4-4-bfbe29ad81f4@linaro.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/thermal/qcom/qcom-spmi-adc-tm5.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
index 5e94a45eba3e..d7f2e6ca92c2 100644
--- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
+++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
@@ -938,7 +938,6 @@ static const struct adc_tm5_data adc_tm5_gen2_data_pmic = {
static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *node)
{
struct adc_tm5_channel *channels;
- struct device_node *child;
u32 value;
int ret;
struct device *dev = adc_tm->dev;
@@ -982,12 +981,10 @@ static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *
adc_tm->avg_samples = VADC_DEF_AVG_SAMPLES;
}
- for_each_available_child_of_node(node, child) {
+ for_each_available_child_of_node_scoped(node, child) {
ret = adc_tm5_get_dt_channel_data(adc_tm, channels, child);
- if (ret) {
- of_node_put(child);
+ if (ret)
return ret;
- }
channels++;
}