of: unittest: treat missing of_root as error instead of fixing up

unflatten_device_tree() now ensures that the 'of_root' node is populated
with the root of a default empty devicetree. Remove the unittest code
that created 'of_root' if it was missing. Verify that 'of_root' is valid
before attempting to attach the testcase-data subtree. Remove the
unittest code that unflattens the unittest overlay base if architecture
is UML because that is always done now.

Signed-off-by: Frank Rowand <frowand.list@gmail.com>
Link: https://lore.kernel.org/r/20230317053415.2254616-3-frowand.list@gmail.com
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240217010557.2381548-7-sboyd@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Frank Rowand 2024-02-16 17:05:55 -08:00 committed by Rob Herring
parent 40f18dbbb4
commit d1eabd218e

View File

@ -1744,20 +1744,16 @@ static int __init unittest_data_add(void)
return -EINVAL;
}
/* attach the sub-tree to live tree */
if (!of_root) {
of_root = unittest_data_node;
for_each_of_allnodes(np)
__of_attach_node_sysfs(np);
of_aliases = of_find_node_by_path("/aliases");
of_chosen = of_find_node_by_path("/chosen");
of_overlay_mutex_unlock();
return 0;
pr_warn("%s: no live tree to attach sub-tree\n", __func__);
kfree(unittest_data);
return -ENODEV;
}
EXPECT_BEGIN(KERN_INFO,
"Duplicate name in testcase-data, renamed to \"duplicate-name#1\"");
/* attach the sub-tree to live tree */
np = unittest_data_node->child;
while (np) {
struct device_node *next = np->sibling;