Skip to content

Commit cc3b17c

Browse files
JuliaLawallgclement
authored andcommitted
soc: dove: add missing of_node_put
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 <[email protected]> Signed-off-by: Gregory CLEMENT <[email protected]>
1 parent 0bb80ec commit cc3b17c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/soc/dove/pmu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
410410
struct pmu_domain *domain;
411411

412412
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
413-
if (!domain)
413+
if (!domain) {
414+
of_node_put(np);
414415
break;
416+
}
415417

416418
domain->pmu = pmu;
417419
domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
418420
if (!domain->base.name) {
419421
kfree(domain);
422+
of_node_put(np);
420423
break;
421424
}
422425

0 commit comments

Comments
 (0)