summaryrefslogtreecommitdiffstats
path: root/drivers/of/unittest.c
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2020-04-16 23:42:46 +0200
committerRob Herring <robh@kernel.org>2020-04-17 15:31:34 +0200
commitb3fb36ed694b05738d45218ea72cf7feb10ce2b1 (patch)
tree094aafa40e72b92a4524f7cf98dc08abca883468 /drivers/of/unittest.c
parentMAINTAINERS: dt: fix pointers for ARM Integrator, Versatile and RealView (diff)
downloadlinux-b3fb36ed694b05738d45218ea72cf7feb10ce2b1.tar.xz
linux-b3fb36ed694b05738d45218ea72cf7feb10ce2b1.zip
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: 201c910bd689 ("of: Transactional DT support.") Reported-by: Erhard F. <erhard_f@mailbox.org> Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/unittest.c')
-rw-r--r--drivers/of/unittest.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 7e27670c3616..20ff2dfc3143 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -861,6 +861,10 @@ static void __init of_unittest_changeset(void)
unittest(!of_changeset_revert(&chgset), "revert failed\n");
of_changeset_destroy(&chgset);
+
+ of_node_put(n1);
+ of_node_put(n2);
+ of_node_put(n21);
#endif
}