diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2024-08-13 15:09:48 +0200 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2024-08-14 22:14:43 -0500 |
commit | c50203cbba1573546f115330530d24382fc53f09 (patch) | |
tree | 45081af17a6c91fc4a13fb9bce441afa4b402164 /drivers/soc/qcom | |
parent | 6c26d9c764c62343722d6ea6c9e4c7e65989f634 (diff) |
soc: qcom: aoss: 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.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240813-b4-cleanup-h-of-node-put-other-v1-2-cfb67323a95c@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r-- | drivers/soc/qcom/qcom_aoss.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index ca2f6b7629ce..60af26667bce 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -394,7 +394,7 @@ static int qmp_cooling_device_add(struct qmp *qmp, static int qmp_cooling_devices_register(struct qmp *qmp) { - struct device_node *np, *child; + struct device_node *np; int count = 0; int ret; @@ -407,15 +407,13 @@ static int qmp_cooling_devices_register(struct qmp *qmp) if (!qmp->cooling_devs) return -ENOMEM; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { if (!of_property_present(child, "#cooling-cells")) continue; ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++], child); - if (ret) { - of_node_put(child); + if (ret) goto unroll; - } } if (!count) |