diff --git a/common/oftree.c b/common/oftree.c index 2a2f464..a657d31 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -293,20 +293,28 @@ return 0; } -struct fdt_header *of_get_fixed_tree(void) +int of_fix_tree(struct fdt_header *fdt) { struct of_fixup *of_fixup; int ret; - if (!barebox_fdt) - return NULL; - list_for_each_entry(of_fixup, &of_fixup_list, list) { - ret = of_fixup->fixup(barebox_fdt); + ret = of_fixup->fixup(fdt); if (ret) - return NULL; + return ret; } - return barebox_fdt; + return 0; } +struct fdt_header *of_get_fixed_tree(void) +{ + int ret; + + if (!barebox_fdt) + return NULL; + ret = of_fix_tree(barebox_fdt); + if (ret) + return NULL; + return barebox_fdt; +} diff --git a/include/of.h b/include/of.h index c2661ef..609b3b5 100644 --- a/include/of.h +++ b/include/of.h @@ -8,6 +8,7 @@ int fdt_print(struct fdt_header *working_fdt, const char *pathp); struct fdt_header *of_get_fixed_tree(void); +int of_fix_tree(struct fdt_header *fdt); int of_register_fixup(int (*fixup)(struct fdt_header *)); int fdt_find_and_setprop(struct fdt_header *fdt, const char *node, const char *prop,