of: add consistency check to of_node_release()
authorFrank Rowand <frowand.list@gmail.com>
Mon, 13 Feb 2023 18:57:01 +0000 (12:57 -0600)
committerRob Herring <robh@kernel.org>
Mon, 20 Feb 2023 21:37:19 +0000 (15:37 -0600)
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 <frowand.list@gmail.com>
Link: https://lore.kernel.org/r/20230213185702.395776-7-frowand.list@gmail.com
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/dynamic.c

index dbcbc41f34651c3f6471f3c31fdaf86c2c0f1585..657a65006056be4e0f15aedee36c4c7f939eba78 100644 (file)
@@ -377,6 +377,10 @@ void of_node_release(struct kobject *kobj)
                               __func__, node);
        }
 
+       if (node->child)
+               pr_err("ERROR: %s() unexpected children for %pOF/%s\n",
+                       __func__, node->parent, node->full_name);
+
        property_list_free(node->properties);
        property_list_free(node->deadprops);
        fwnode_links_purge(of_fwnode_handle(node));