diff options
author | Frank Rowand <frank.rowand@sony.com> | 2020-04-17 00:42:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-23 11:37:53 +0300 |
commit | 52a76fc6b59b1b727be6fd297e612fbd68fc677d (patch) | |
tree | 9caaf59c56cd0fd382dfc8e42e34b81089e3cdf1 | |
parent | 98d3c852e63b49129515dd18c875999efaf8530a (diff) | |
download | linux-52a76fc6b59b1b727be6fd297e612fbd68fc677d.tar.xz |
of: unittest: kmemleak on changeset destroy
commit b3fb36ed694b05738d45218ea72cf7feb10ce2b1 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/of/unittest.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 68b87587b2ef..3fff96088b45 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -777,6 +777,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 } |