Skip to content

Commit d1eabd2

Browse files
frowandrobherring
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Rob Herring <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 40f18db commit d1eabd2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/of/unittest.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,20 +1744,16 @@ static int __init unittest_data_add(void)
17441744
return -EINVAL;
17451745
}
17461746

1747+
/* attach the sub-tree to live tree */
17471748
if (!of_root) {
1748-
of_root = unittest_data_node;
1749-
for_each_of_allnodes(np)
1750-
__of_attach_node_sysfs(np);
1751-
of_aliases = of_find_node_by_path("/aliases");
1752-
of_chosen = of_find_node_by_path("/chosen");
1753-
of_overlay_mutex_unlock();
1754-
return 0;
1749+
pr_warn("%s: no live tree to attach sub-tree\n", __func__);
1750+
kfree(unittest_data);
1751+
return -ENODEV;
17551752
}
17561753

17571754
EXPECT_BEGIN(KERN_INFO,
17581755
"Duplicate name in testcase-data, renamed to \"duplicate-name#1\"");
17591756

1760-
/* attach the sub-tree to live tree */
17611757
np = unittest_data_node->child;
17621758
while (np) {
17631759
struct device_node *next = np->sibling;

0 commit comments

Comments
 (0)