Skip to content

Commit b3fb36e

Browse files
frowandrobherring
authored andcommitted
of: unittest: kmemleak on changeset destroy
kmemleak reports several memory leaks from devicetree unittest. This is the fix for problem 1 of 5. of_unittest_changeset() reaches deeply into the dynamic devicetree functions. Several nodes were left with an elevated reference count and thus were not properly cleaned up. Fix the reference counts so that the memory will be freed. Fixes: 201c910 ("of: Transactional DT support.") Reported-by: Erhard F. <[email protected]> Signed-off-by: Frank Rowand <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 21a431e commit b3fb36e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/of/unittest.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,10 @@ static void __init of_unittest_changeset(void)
861861
unittest(!of_changeset_revert(&chgset), "revert failed\n");
862862

863863
of_changeset_destroy(&chgset);
864+
865+
of_node_put(n1);
866+
of_node_put(n2);
867+
of_node_put(n21);
864868
#endif
865869
}
866870

0 commit comments

Comments
 (0)