On Mon, May 02, 2022 at 01:17:41PM -0500, frowand.list@xxxxxxxxx wrote: > From: Frank Rowand <frank.rowand@xxxxxxxx> > > Add tests for overlay apply and remove notifiers. Trigger errors > for each of the notifier actions. > > These tests will reveal a memory leak problem when a notifier returns > an error for action OF_OVERLAY_POST_APPLY. The pr_err() message is: > > OF: ERROR: memory leak, expected refcount 1 instead of 3, > of_node_get()/of_node_put() unbalanced - destroy cset entry: attach > overlay node /testcase-data/overlay-node/test-bus/test-unittest17 > > Signed-off-by: Frank Rowand <frank.rowand@xxxxxxxx> > --- > Changes since version 1: > - patch 1/1 v1 did not apply on Rob's dt/next branch, rebase on top of > 5f756a2eaa44 of: overlay: do not break notify on NOTIFY_{OK|STOP} > > Output of the new overlay notifier unittests, as filtered by > scripts/dtc/of_unittest_expect: > > ### dt-test ### pass of_unittest_overlay_notify():2825 > ok OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overlay-node/test-bus > ### dt-test ### pass of_unittest_overlay_notify():2846 > ### dt-test ### pass of_unittest_overlay_notify():2851 > ok OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overlay-node/test-bus > OF: ERROR: memory leak, expected refcount 1 instead of 3, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /testcase-data/overlay-node/test-bus/test-unittest17 > ### dt-test ### pass of_unittest_overlay_notify():2857 > ### dt-test ### pass of_unittest_overlay_notify():2862 > ### dt-test ### pass of_unittest_overlay_notify():2866 > ### dt-test ### pass of_unittest_overlay_notify():2869 > ok OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overlay-node/test-bus > ### dt-test ### pass of_unittest_overlay_notify():2880 > ### dt-test ### pass of_unittest_overlay_notify():2888 > ### dt-test ### pass of_unittest_overlay_notify():2892 > ### dt-test ### pass of_unittest_overlay_notify():2895 > ok OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overlay-node/test-bus > ### dt-test ### pass of_unittest_overlay_notify():2902 > ### dt-test ### pass of_unittest_overlay_notify():2909 > ### dt-test ### pass of_unittest_overlay_notify():2914 > ### dt-test ### pass of_unittest_overlay_notify():2926 > > Note that four new kernel error messages are triggered by the new > tests, and of_unittest_expect labels them as expected errors with > the string 'ok ' in the first three columns. > > A fifth new kernel error message is a real bug, which will be fixed > in patch 3/3: > > OF: ERROR: memory leak, expected refcount 1 instead of 3, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /testcase-data/overlay-node/test-bus/test-unittest17 > > > drivers/of/unittest-data/Makefile | 10 ++ > drivers/of/unittest-data/overlay_16.dts | 15 ++ > drivers/of/unittest-data/overlay_17.dts | 15 ++ > drivers/of/unittest-data/overlay_18.dts | 15 ++ > drivers/of/unittest-data/overlay_19.dts | 15 ++ > drivers/of/unittest-data/overlay_20.dts | 15 ++ > drivers/of/unittest.c | 198 ++++++++++++++++++++++++ > 7 files changed, 283 insertions(+) > create mode 100644 drivers/of/unittest-data/overlay_16.dts > create mode 100644 drivers/of/unittest-data/overlay_17.dts > create mode 100644 drivers/of/unittest-data/overlay_18.dts > create mode 100644 drivers/of/unittest-data/overlay_19.dts > create mode 100644 drivers/of/unittest-data/overlay_20.dts Applied, thanks!