Skip to content

Commit

Permalink
soc: dove: add missing of_node_put
Browse files Browse the repository at this point in the history
for_each_available_child_of_node 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>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
  • Loading branch information
Julia Lawall authored and Gregory CLEMENT committed Sep 20, 2023
1 parent 0bb80ec commit cc3b17c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/soc/dove/pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
struct pmu_domain *domain;

domain = kzalloc(sizeof(*domain), GFP_KERNEL);
if (!domain)
if (!domain) {
of_node_put(np);
break;
}

domain->pmu = pmu;
domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
if (!domain->base.name) {
kfree(domain);
of_node_put(np);
break;
}

Expand Down

0 comments on commit cc3b17c

Please sign in to comment.