Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Kozlowski and committed by
Rafael J. Wysocki
4dc00afc 8309135a

+2 -5
+2 -5
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
··· 938 938 static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *node) 939 939 { 940 940 struct adc_tm5_channel *channels; 941 - struct device_node *child; 942 941 u32 value; 943 942 int ret; 944 943 struct device *dev = adc_tm->dev; ··· 981 982 adc_tm->avg_samples = VADC_DEF_AVG_SAMPLES; 982 983 } 983 984 984 - for_each_available_child_of_node(node, child) { 985 + for_each_available_child_of_node_scoped(node, child) { 985 986 ret = adc_tm5_get_dt_channel_data(adc_tm, channels, child); 986 - if (ret) { 987 - of_node_put(child); 987 + if (ret) 988 988 return ret; 989 - } 990 989 991 990 channels++; 992 991 }