<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/of/unittest.c, branch v5.9-rc7</title>
<subtitle>Linux Kernel (branches are rebased on master from time to time)</subtitle>
<id>https://sre.ring0.de/linux/atom?h=v5.9-rc7</id>
<link rel='self' href='https://sre.ring0.de/linux/atom?h=v5.9-rc7'/>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/'/>
<updated>2020-08-03T22:24:49Z</updated>
<entry>
<title>of: unittest: Use bigger address cells to catch parser regressions</title>
<updated>2020-08-03T22:24:49Z</updated>
<author>
<name>Nicolas Saenz Julienne</name>
<email>nsaenzjulienne@suse.de</email>
</author>
<published>2020-08-03T14:25:47Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=bda2127827e9dd2781ae095cda0b8e5bf685c458'/>
<id>urn:sha1:bda2127827e9dd2781ae095cda0b8e5bf685c458</id>
<content type='text'>
Getting address and size cells for dma-ranges/ranges parsing is tricky
and shouldn't rely on the node's count_cells() method. The function
starts looking for cells on the parent node, as its supposed to work
with device nodes, which doesn't work when input with bus nodes, as
generally done when parsing ranges.

Add test to catch regressions on that specific quirk as developers will
be tempted to edit it out in favor of the default method.

Signed-off-by: Nicolas Saenz Julienne &lt;nsaenzjulienne@suse.de&gt;
Link: https://lore.kernel.org/r/9200970a917a9cabdc5b17483b5a8725111eb9d0.camel@suse.de
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: kmemleak in duplicate property update</title>
<updated>2020-04-17T13:31:34Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-04-16T21:42:50Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=29acfb65598f91671413869e0d0a1ec4e74ac705'/>
<id>urn:sha1:29acfb65598f91671413869e0d0a1ec4e74ac705</id>
<content type='text'>
kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 5 of 5.

When overlay 'overlay_bad_add_dup_prop' is applied, the apply code
properly detects that a memory leak will occur if the overlay is removed
since the duplicate property is located in a base devicetree node and
reports via printk():

  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail
  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail

The overlay is removed when the apply code detects multiple changesets
modifying the same property.  This is reported via printk():

  OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail

As a result of this error, the overlay is removed resulting in the
expected memory leak.

Add another device node level to the overlay so that the duplicate
property is located in a node added by the overlay, thus no memory
leak will occur when the overlay is removed.

Thus users of kmemleak will not have to debug this leak in the future.

Fixes: 2fe0e8769df9 ("of: overlay: check prevents multiple fragments touching same property")
Reported-by: Erhard F. &lt;erhard_f@mailbox.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: kmemleak in of_unittest_overlay_high_level()</title>
<updated>2020-04-17T13:31:34Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-04-16T21:42:48Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=145fc138f9aae4f9e1331352e301df28e16aed35'/>
<id>urn:sha1:145fc138f9aae4f9e1331352e301df28e16aed35</id>
<content type='text'>
kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 3 of 5.

of_unittest_overlay_high_level() failed to kfree the newly created
property when the property named 'name' is skipped.

Fixes: 39a751a4cb7e ("of: change overlay apply input data from unflattened to FDT")
Reported-by: Erhard F. &lt;erhard_f@mailbox.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: kmemleak in of_unittest_platform_populate()</title>
<updated>2020-04-17T13:31:34Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-04-16T21:42:47Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=216830d2413cc61be3f76bc02ffd905e47d2439e'/>
<id>urn:sha1:216830d2413cc61be3f76bc02ffd905e47d2439e</id>
<content type='text'>
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. &lt;erhard_f@mailbox.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: kmemleak on changeset destroy</title>
<updated>2020-04-17T13:31:34Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-04-16T21:42:46Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=b3fb36ed694b05738d45218ea72cf7feb10ce2b1'/>
<id>urn:sha1:b3fb36ed694b05738d45218ea72cf7feb10ce2b1</id>
<content type='text'>
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. &lt;erhard_f@mailbox.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: some unittest overlays not untracked</title>
<updated>2020-03-31T21:57:58Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-03-26T01:45:31Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=1adc86798fda9a9b989433a52640b8ad1446a71d'/>
<id>urn:sha1:1adc86798fda9a9b989433a52640b8ad1446a71d</id>
<content type='text'>
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 &lt;lkp@intel.com&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: gpio unittest kfree() wrong object</title>
<updated>2020-03-31T21:57:39Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-03-26T01:45:30Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=fb227f597d612c6660888d1947e68a25fed7b9cc'/>
<id>urn:sha1:fb227f597d612c6660888d1947e68a25fed7b9cc</id>
<content type='text'>
kernel test robot reported "WARNING: held lock freed!" triggered by
unittest_gpio_remove().  unittest_gpio_remove() was unexpectedly
called due to an error in overlay tracking.  The remove had not
been tested because the gpio overlay removal tests have not been
implemented.

kfree() gdev instead of pdev.

Fixes: f4056e705b2e ("of: unittest: add overlay gpio test to catch gpio hog problem")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: make gpio overlay test dependent on CONFIG_OF_GPIO</title>
<updated>2020-03-02T17:32:30Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-02-28T04:16:29Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=485bb19d0b3eb3b679211800e3fd61e8b33ebb20'/>
<id>urn:sha1:485bb19d0b3eb3b679211800e3fd61e8b33ebb20</id>
<content type='text'>
Randconfig testing found compile errors in drivers/of/unittest.c if
CONFIG_GPIOLIB is not set because CONFIG_OF_GPIO depends on
CONFIG_GPIOLIB.  Make the gpio overlay test depend on CONFIG_OF_GPIO.

No code is modified, it is only moved to a different location and
protected with #ifdef CONFIG_OF_GPIO.  An empty
of_unittest_overlay_gpio() is added in the #else.

Fixes: f4056e705b2e ("of: unittest: add overlay gpio test to catch gpio hog problem")
Reported-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Acked-by: Randy Dunlap &lt;rdunlap@infradead.org&gt; # build-tested
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: annotate warnings triggered by unittest</title>
<updated>2020-02-26T16:42:15Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-02-20T18:40:21Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=0ac1743979408a4999f32b777ce71f40fac040fa'/>
<id>urn:sha1:0ac1743979408a4999f32b777ce71f40fac040fa</id>
<content type='text'>
Some tests in the devicetree unittests result in printk messages
from the code being tested.  It can be difficult to determine
whether the messages are the result of unittest or are potentially
reporting bugs that should be fixed.  The most recent example of
a person asking whether to be concerned about these messages is [1].

Add annotations for all messages triggered by unittests, except
KERN_DEBUG messages.  (KERN_DEBUG is a special case due to the
possible interaction of CONFIG_DYNAMIC_DEBUG.)

The format of the annotations is expected to change when unittests
are converted to use the kunit infrastructure when the broader
testing community has an opportunity to discuss the implementation
of annotations of test triggered messages.

[1] https://lore.kernel.org/r/6021ac63-b5e0-ed3d-f964-7c6ef579cd68@huawei.com

Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: add overlay gpio test to catch gpio hog problem</title>
<updated>2020-02-26T16:42:04Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-02-20T18:40:20Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=f4056e705b2ef7f123a188f6aee23ade70e7d793'/>
<id>urn:sha1:f4056e705b2ef7f123a188f6aee23ade70e7d793</id>
<content type='text'>
Geert reports that gpio hog nodes are not properly processed when
the gpio hog node is added via an overlay reply and provides an
RFC patch to fix the problem [1].

Add a unittest that shows the problem.  Unittest will report "1 failed"
test before applying Geert's RFC patch and "0 failed" after applying
Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/20191230133852.5890-1-geert+renesas@glider.be/

Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
</feed>
