Skip to content

Commit 91c6586

Browse files
committed
cpuidle: psci: Simplify with scoped for each OF child loop
JIRA: https://issues.redhat.com/browse/RHEL-64032 commit 7aa1204 Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Date: Tue, 20 Aug 2024 11:30:39 +0000 Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20240816150931.142208-1-krzysztof.kozlowski@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent 5ce1a10 commit 91c6586

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/cpuidle/cpuidle-psci-domain.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ static const struct of_device_id psci_of_match[] = {
142142
static int psci_cpuidle_domain_probe(struct platform_device *pdev)
143143
{
144144
struct device_node *np = pdev->dev.of_node;
145-
struct device_node *node;
146145
bool use_osi = psci_has_osi_support();
147146
int ret = 0, pd_count = 0;
148147

@@ -153,15 +152,13 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
153152
* Parse child nodes for the "#power-domain-cells" property and
154153
* initialize a genpd/genpd-of-provider pair when it's found.
155154
*/
156-
for_each_child_of_node(np, node) {
155+
for_each_child_of_node_scoped(np, node) {
157156
if (!of_property_present(node, "#power-domain-cells"))
158157
continue;
159158

160159
ret = psci_pd_init(node, use_osi);
161-
if (ret) {
162-
of_node_put(node);
160+
if (ret)
163161
goto exit;
164-
}
165162

166163
pd_count++;
167164
}

0 commit comments

Comments
 (0)