On 12/14/21 1:13 AM, Lars-Peter Clausen wrote:
On 12/13/21 8:31 PM, Tanmay Shah wrote:
+static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
+{
[...]
+
+ i = 0;
+ for_each_available_child_of_node(dev_node, child) {
+ child_pdev = of_find_device_by_node(child);
+ if (!child_pdev)
A return or a break in a for_each_available_child_of_node() will
leak the reference to the child node.
Do you mean I have to use of_put_node for each child?
You have to put a `of_put_node(child)` before each break or return in
the loop.
If you search the kernel commit history for
for_each_available_child_of_node or for_each_child_of_node you'll find
many fixes for similar problems. For example
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e1b391e9712db
I got it. Same concern was posted by Mathieu also. I will address these
comments in next revision.
Thanks,
Tanmay