Skip to content

Commit 7aa1204

Browse files
krzkstorulf
authored andcommitted
cpuidle: psci: Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 9b37f97 commit 7aa1204

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)