]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: unittest: kmemleak in of_unittest_platform_populate()
authorFrank Rowand <frank.rowand@sony.com>
Thu, 16 Apr 2020 21:42:47 +0000 (16:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:30:14 +0000 (10:30 +0200)
commit842f7bbaf44cdc5da018474c23938843db6e500b
tree15a323dd87ee3d9821d52fc7f18542c5b3e0bb50
parent3352cc2f7b71077c3914c7bec8cec24a68b4551b
of: unittest: kmemleak in of_unittest_platform_populate()

commit 216830d2413cc61be3f76bc02ffd905e47d2439e upstream.

kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 2 of 5.

of_unittest_platform_populate() left an elevated reference count for
grandchild nodes (which are platform devices).  Fix the platform
device reference counts so that the memory will be freed.

Fixes: fb2caa50fbac ("of/selftest: add testcase for nodes with same name and address")
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>
drivers/of/unittest.c