dm: core: Add a function to create an empty tree

Provide a function to create a new, empty tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-09-26 08:14:40 -06:00
committed by Tom Rini
parent 9bf78a5add
commit e0c3c21d8b
5 changed files with 104 additions and 4 deletions

View File

@@ -1346,3 +1346,19 @@ static int dm_test_livetree_ensure(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_livetree_ensure, UT_TESTF_SCAN_FDT);
static int dm_test_oftree_new(struct unit_test_state *uts)
{
ofnode node, subnode, check;
oftree tree;
ut_assertok(oftree_new(&tree));
node = oftree_root(tree);
ut_assert(ofnode_valid(node));
ut_assertok(ofnode_add_subnode(node, "edmund", &subnode));
check = ofnode_find_subnode(node, "edmund");
ut_asserteq(check.of_offset, subnode.of_offset);
return 0;
}
DM_TEST(dm_test_oftree_new, UT_TESTF_SCAN_FDT);