<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/of/dynamic.c, branch v6.5.12</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.5.12</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.5.12'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2023-10-10T20:03:04Z</updated>
<entry>
<title>of: dynamic: Fix potential memory leak in of_changeset_action()</title>
<updated>2023-10-10T20:03:04Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@linaro.org</email>
</author>
<published>2023-09-08T07:03:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=641c751ff1200a54d0a67f680d4c881f2bbcf371'/>
<id>urn:sha1:641c751ff1200a54d0a67f680d4c881f2bbcf371</id>
<content type='text'>
commit 55e95bfccf6db8d26a66c46e1de50d53c59a6774 upstream.

Smatch complains that the error path where "action" is invalid leaks
the "ce" allocation:
    drivers/of/dynamic.c:935 of_changeset_action()
    warn: possible memory leak of 'ce'

Fix this by doing the validation before the allocation.

Note that there is not any actual problem with upstream kernels. All
callers of of_changeset_action() are static inlines with fixed action
values.

Fixes: 914d9d831e61 ("of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/r/202309011059.EOdr4im9-lkp@intel.com/
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Link: https://lore.kernel.org/r/7dfaf999-30ad-491c-9615-fb1138db121c@moroto.mountain
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock</title>
<updated>2023-08-21T14:23:55Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2023-08-18T20:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=914d9d831e6126a6e7a92e27fcfaa250671be42c'/>
<id>urn:sha1:914d9d831e6126a6e7a92e27fcfaa250671be42c</id>
<content type='text'>
While originally it was fine to format strings using "%pOF" while
holding devtree_lock, this now causes a deadlock.  Lockdep reports:

    of_get_parent from of_fwnode_get_parent+0x18/0x24
    ^^^^^^^^^^^^^
    of_fwnode_get_parent from fwnode_count_parents+0xc/0x28
    fwnode_count_parents from fwnode_full_name_string+0x18/0xac
    fwnode_full_name_string from device_node_string+0x1a0/0x404
    device_node_string from pointer+0x3c0/0x534
    pointer from vsnprintf+0x248/0x36c
    vsnprintf from vprintk_store+0x130/0x3b4

Fix this by moving the printing in __of_changeset_entry_apply() outside
the lock. As the only difference in the multiple prints is the action
name, use the existing "action_names" to refactor the prints into a
single print.

Fixes: a92eb7621b9fb2c2 ("lib/vsprintf: Make use of fwnode API to obtain node names and separators")
Cc: stable@vger.kernel.org
Reported-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Link: https://lore.kernel.org/r/20230801-dt-changeset-fixes-v3-2-5f0410e007dd@kernel.org
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'devicetree-fixes-for-6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux</title>
<updated>2023-04-13T22:21:56Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-04-13T22:21:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4413ad01e27eb989f4b19bb5b038328c220a383d'/>
<id>urn:sha1:4413ad01e27eb989f4b19bb5b038328c220a383d</id>
<content type='text'>
Pull devicetree fixes from Rob Herring:

 - Fix interaction between fw_devlink and DT overlays causing devices to
   not be probed

 - Fix the compatible string for loongson,cpu-interrupt-controller

* tag 'devicetree-fixes-for-6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  treewide: Fix probing of devices in DT overlays
  dt-bindings: interrupt-controller: loongarch: Fix mismatched compatible
</content>
</entry>
<entry>
<title>treewide: Fix probing of devices in DT overlays</title>
<updated>2023-04-11T19:39:52Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2023-03-30T13:26:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924'/>
<id>urn:sha1:1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924</id>
<content type='text'>
When loading a DT overlay that creates a device, the device is not
probed, unless the DT overlay is unloaded and reloaded again.

After the recent refactoring to improve fw_devlink, it no longer depends
on the "compatible" property to identify which device tree nodes will
become struct devices.   fw_devlink now picks up dangling consumers
(consumers pointing to descendent device tree nodes of a device that
aren't converted to child devices) when a device is successfully bound
to a driver.  See __fw_devlink_pickup_dangling_consumers().

However, during DT overlay, a device's device tree node can have
sub-nodes added/removed without unbinding/rebinding the driver.  This
difference in behavior between the normal device instantiation and
probing flow vs. the DT overlay flow has a bunch of implications that
are pointed out elsewhere[1].  One of them is that the fw_devlink logic
to pick up dangling consumers is never exercised.

This patch solves the fw_devlink issue by marking all DT nodes added by
DT overlays with FWNODE_FLAG_NOT_DEVICE (fwnode that won't become
device), and by clearing the flag when a struct device is actually
created for the DT node.  This way, fw_devlink knows not to have
consumers waiting on these newly added DT nodes, and to propagate the
dependency to an ancestor DT node that has the corresponding struct
device.

Based on a patch by Saravana Kannan, which covered only platform and spi
devices.

[1] https://lore.kernel.org/r/CAGETcx_bkuFaLCiPrAWCPQz+w79ccDp6=9e881qmK=vx3hBMyg@mail.gmail.com

Fixes: 4a032827daa89350 ("of: property: Simplify of_link_to_phandle()")
Link: https://lore.kernel.org/r/CAGETcx_+rhHvaC_HJXGrr5_WAd2+k5f=rWYnkCZ6z5bGX-wj4w@mail.gmail.com
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Acked-by: Mark Brown &lt;broonie@kernel.org&gt;
Acked-by: Wolfram Sang &lt;wsa@kernel.org&gt; # for I2C
Acked-by: Shawn Guo &lt;shawnguo@kernel.org&gt;
Acked-by: Saravana Kannan &lt;saravanak@google.com&gt;
Tested-by: Ivan Bornyakov &lt;i.bornyakov@metrotek.ru&gt;
Link: https://lore.kernel.org/r/e1fa546682ea4c8474ff997ab6244c5e11b6f8bc.1680182615.git.geert+renesas@glider.be
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: dynamic: Fix spelling mistake "kojbect" -&gt; "kobject"</title>
<updated>2023-02-21T16:22:04Z</updated>
<author>
<name>Colin Ian King</name>
<email>colin.i.king@gmail.com</email>
</author>
<published>2023-02-20T14:44:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b4858dc61647e5439cbba79022bfc87328c1fb84'/>
<id>urn:sha1:b4858dc61647e5439cbba79022bfc87328c1fb84</id>
<content type='text'>
There is a spelling mistake in a pr_err message. Fix it.

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Reviewed-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Link: https://lore.kernel.org/r/20230220144422.873356-1-colin.i.king@gmail.com
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: dynamic: add lifecycle docbook info to node creation functions</title>
<updated>2023-02-20T21:37:19Z</updated>
<author>
<name>Frank Rowand</name>
<email>frowand.list@gmail.com</email>
</author>
<published>2023-02-13T18:57:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d9194e009efef9613f48022f3c885191c48120f9'/>
<id>urn:sha1:d9194e009efef9613f48022f3c885191c48120f9</id>
<content type='text'>
The existing docbook comments for the functions related to creating
a devicetree node do not explain the reference count of a newly
created node, how decrementing the reference count to zero will
free the associated memory, and the caller's responsibility to
call of_node_put() on the node.  Explain what happens when the
reference count is decremented to zero.

Signed-off-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Link: https://lore.kernel.org/r/20230213185702.395776-8-frowand.list@gmail.com
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: add consistency check to of_node_release()</title>
<updated>2023-02-20T21:37:19Z</updated>
<author>
<name>Frank Rowand</name>
<email>frowand.list@gmail.com</email>
</author>
<published>2023-02-13T18:57:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ec0b7e24d566a843e3cfba21a6471170fdb0f810'/>
<id>urn:sha1:ec0b7e24d566a843e3cfba21a6471170fdb0f810</id>
<content type='text'>
Add an additional consistency check to of_node_release(), which is
called when the reference count of a devicetree node is decremented
to zero.  The node's children should have been deleted before the
node is deleted so check that no children exist.

Signed-off-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Link: https://lore.kernel.org/r/20230213185702.395776-7-frowand.list@gmail.com
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: do not use "%pOF" printk format on node with refcount of zero</title>
<updated>2023-02-20T21:37:19Z</updated>
<author>
<name>Frank Rowand</name>
<email>frowand.list@gmail.com</email>
</author>
<published>2023-02-13T18:57:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=23522dd7033ad8dcd818f75469907a8fdac8e8a4'/>
<id>urn:sha1:23522dd7033ad8dcd818f75469907a8fdac8e8a4</id>
<content type='text'>
of_node_release() can not use the "%pOF" printk format to report
the node name of a node when the node reference count is zero.
This is because the formatter device_node_string() calls
fwnode_full_name_string() which indirectly calls of_node_get().
Calling of_node_get() on the node with a zero reference count
results in a WARNING and stack trace.

When the reference count has been decremented to zero, this function
is in the subsequent call path which frees memory related to the node.

This commit resolves the unittest EXPECT errors that were created in
the previous commmit.

Signed-off-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Link: https://lore.kernel.org/r/20230213185702.395776-6-frowand.list@gmail.com
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: add node lifecycle tests</title>
<updated>2023-02-20T21:36:51Z</updated>
<author>
<name>Frank Rowand</name>
<email>frowand.list@gmail.com</email>
</author>
<published>2023-02-13T18:56:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=74df14cd301a1433947077e79ce2c610654a32e7'/>
<id>urn:sha1:74df14cd301a1433947077e79ce2c610654a32e7</id>
<content type='text'>
Add tests to exercise the actions that occur when the reference count
of devicetree nodes decrement to zero and beyond.  Decrementing to
zero triggers freeing memory allocated for the node.

This commit will expose a pr_err() issue in of_node_release(), resulting
in some kernal warnings and stack traces.

When scripts/dtc/of_unittest_expect processes the console messages,
it will also report related problems for EXPECT messages due to the
pr_err() issue:
   **     missing EXPECT begin      :    5

Signed-off-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Link: https://lore.kernel.org/r/20230213185702.395776-5-frowand.list@gmail.com
[robh: Fix !CONFIG_OF_DYNAMIC build]
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: Add missing 'Return' section in kerneldoc comments</title>
<updated>2021-03-27T18:59:03Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2021-03-25T16:47:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8c8239c2c1fb82f171cb22a707f3bb88a2f22109'/>
<id>urn:sha1:8c8239c2c1fb82f171cb22a707f3bb88a2f22109</id>
<content type='text'>
Many of the DT kerneldoc comments are lacking a 'Return' section. Let's
add the section in cases we have a description of return values. There's
still some cases where the return values are not documented.

Cc: Frank Rowand &lt;frowand.list@gmail.com&gt;
Cc: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Reviewed-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Link: https://lore.kernel.org/r/20210325164713.1296407-8-robh@kernel.org
</content>
</entry>
</feed>
