@@ -130,11 +130,10 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
130
130
131
131
int dt_idle_pd_init_topology (struct device_node * np )
132
132
{
133
- struct device_node * node ;
134
133
struct of_phandle_args child , parent ;
135
134
int ret ;
136
135
137
- for_each_child_of_node (np , node ) {
136
+ for_each_child_of_node_scoped (np , node ) {
138
137
if (of_parse_phandle_with_args (node , "power-domains" ,
139
138
"#power-domain-cells" , 0 , & parent ))
140
139
continue ;
@@ -143,22 +142,19 @@ int dt_idle_pd_init_topology(struct device_node *np)
143
142
child .args_count = 0 ;
144
143
ret = of_genpd_add_subdomain (& parent , & child );
145
144
of_node_put (parent .np );
146
- if (ret ) {
147
- of_node_put (node );
145
+ if (ret )
148
146
return ret ;
149
- }
150
147
}
151
148
152
149
return 0 ;
153
150
}
154
151
155
152
int dt_idle_pd_remove_topology (struct device_node * np )
156
153
{
157
- struct device_node * node ;
158
154
struct of_phandle_args child , parent ;
159
155
int ret ;
160
156
161
- for_each_child_of_node (np , node ) {
157
+ for_each_child_of_node_scoped (np , node ) {
162
158
if (of_parse_phandle_with_args (node , "power-domains" ,
163
159
"#power-domain-cells" , 0 , & parent ))
164
160
continue ;
@@ -167,10 +163,8 @@ int dt_idle_pd_remove_topology(struct device_node *np)
167
163
child .args_count = 0 ;
168
164
ret = of_genpd_remove_subdomain (& parent , & child );
169
165
of_node_put (parent .np );
170
- if (ret ) {
171
- of_node_put (node );
166
+ if (ret )
172
167
return ret ;
173
- }
174
168
}
175
169
176
170
return 0 ;
0 commit comments