X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=drivers%2Fof%2Funittest.c;h=cccde756b51097d4c762b6e41ea1770d5118466e;hb=7b47a9e7c8f672b6fb0b77fca11a63a8a77f5a91;hp=84427384654d567cee169b54b7bd8661a94fe717;hpb=0a5cf9e88b5178d15f00f3cf35081841d80403cd;p=linux-2.6-block.git diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 84427384654d..cccde756b510 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1116,15 +1116,22 @@ static void update_node_properties(struct device_node *np, for (prop = np->properties; prop != NULL; prop = save_next) { save_next = prop->next; ret = of_add_property(dup, prop); - if (ret) + if (ret) { + if (ret == -EEXIST && !strcmp(prop->name, "name")) + continue; pr_err("unittest internal error: unable to add testdata property %pOF/%s", np, prop->name); + } } } /** * attach_node_and_children - attaches nodes - * and its children to live tree + * and its children to live tree. + * CAUTION: misleading function name - if node @np already exists in + * the live tree then children of @np are *not* attached to the live + * tree. This works for the current test devicetree nodes because such + * nodes do not have child nodes. * * @np: Node to attach to live tree */ @@ -2234,7 +2241,13 @@ static struct device_node *overlay_base_root; static void * __init dt_alloc_memory(u64 size, u64 align) { - return memblock_alloc(size, align); + void *ptr = memblock_alloc(size, align); + + if (!ptr) + panic("%s: Failed to allocate %llu bytes align=0x%llx\n", + __func__, size, align); + + return ptr; } /* @@ -2514,6 +2527,10 @@ static int __init of_unittest(void) int res; /* adding data for unittest */ + + if (IS_ENABLED(CONFIG_UML)) + unittest_unflatten_overlay_base(); + res = unittest_data_add(); if (res) return res;