of: some unittest overlays not untracked
authorFrank Rowand <frank.rowand@sony.com>
Thu, 26 Mar 2020 01:45:31 +0000 (20:45 -0500)
committerRob Herring <robh@kernel.org>
Tue, 31 Mar 2020 21:57:58 +0000 (15:57 -0600)
commit1adc86798fda9a9b989433a52640b8ad1446a71d
treeec0e674223ea087f0ec3837bb185aea7d15ae4bb
parentfb227f597d612c6660888d1947e68a25fed7b9cc
of: some unittest overlays not untracked

kernel test robot reported "WARNING: held lock freed!" triggered by
unittest_gpio_remove(), which should not have been called because
the related gpio overlay was not tracked.  Another overlay that
was tracked had previously used the same id as the gpio overlay
but had not been untracked when the overlay was removed.  Thus the
clean up function of_unittest_destroy_tracked_overlays() incorrectly
attempted to remove the reused overlay id.

Patch contents:

  - Create tracking related helper functions
  - Change BUG() to WARN_ON() for overlay id related issues
  - Add some additional error checking for valid overlay id values
  - Add the missing overlay untrack
  - update comment on expectation that overlay ids are assigned in
    sequence

Fixes: 492a22aceb75 ("of: unittest: overlay: Keep track of created overlays")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/unittest.c