summaryrefslogtreecommitdiff
path: root/lib/of_live.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/of_live.c')
-rw-r--r--lib/of_live.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/of_live.c b/lib/of_live.c
index 25f7af61061..e4eee385547 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -336,3 +336,22 @@ void of_live_free(struct device_node *root)
/* the tree is stored as a contiguous block of memory */
free(root);
}
+
+int of_live_create_empty(struct device_node **rootp)
+{
+ struct device_node *root;
+
+ root = calloc(1, sizeof(struct device_node));
+ if (!root)
+ return -ENOMEM;
+ root->name = strdup("");
+ if (!root->name) {
+ free(root);
+ return -ENOMEM;
+ }
+ root->type = "<NULL>";
+ root->full_name = "";
+ *rootp = root;
+
+ return 0;
+}