[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1587073370-25963-2-git-send-email-frowand.list@gmail.com>
Date: Thu, 16 Apr 2020 16:42:46 -0500
From: frowand.list@...il.com
To: Rob Herring <robh+dt@...nel.org>, pantelis.antoniou@...sulko.com
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>,
"Erhard F." <erhard_f@...lbox.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Alan Tull <atull@...nel.org>
Subject: [PATCH 1/5] of: unittest: kmemleak on changeset destroy
From: Frank Rowand <frank.rowand@...y.com>
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@...lbox.org>
Signed-off-by: Frank Rowand <frank.rowand@...y.com>
---
drivers/of/unittest.c | 4 ++++
1 file changed, 4 insertions(+)
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
}
--
Frank Rowand <frank.rowand@...y.com>
Powered by blists - more mailing lists