Skip to content

Commit bc0d59d

Browse files
JuliaLawallUlf Hansson
authored andcommitted
pmdomain: ti: add missing of_node_put
for_each_node_with_property performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. This was done using the Coccinelle semantic patch iterators/for_each_child.cocci Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Link: https://lore.kernel.org/r/20230907095521.14053-5-Julia.Lawall@inria.fr Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent c5b5831 commit bc0d59d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/pmdomain/ti/ti_sci_pm_domains.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,18 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
153153
max_id = args.args[0];
154154

155155
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
156-
if (!pd)
156+
if (!pd) {
157+
of_node_put(np);
157158
return -ENOMEM;
159+
}
158160

159161
pd->pd.name = devm_kasprintf(dev, GFP_KERNEL,
160162
"pd:%d",
161163
args.args[0]);
162-
if (!pd->pd.name)
164+
if (!pd->pd.name) {
165+
of_node_put(np);
163166
return -ENOMEM;
167+
}
164168

165169
pd->pd.power_off = ti_sci_pd_power_off;
166170
pd->pd.power_on = ti_sci_pd_power_on;

0 commit comments

Comments
 (0)