of: unittest: treat missing of_root as error instead of fixing up
[linux-2.6-microblaze.git] / drivers / of / unittest.c
index 891752a..4c67de3 100644 (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;