summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/fdt_support.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index b010d0b552..9c84702b19 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -951,9 +951,7 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
struct mtd_device *dev;
int i, idx;
int noff;
-
- if (mtdparts_init() != 0)
- return;
+ bool inited = false;
for (i = 0; i < node_info_size; i++) {
idx = 0;
@@ -963,6 +961,13 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
debug("%s: %s, mtd dev type %d\n",
fdt_get_name(blob, noff, 0),
node_info[i].compat, node_info[i].type);
+
+ if (!inited) {
+ if (mtdparts_init() != 0)
+ return;
+ inited = true;
+ }
+
dev = device_find(node_info[i].type, idx++);
if (dev) {
if (fdt_node_set_part_info(blob, noff, dev))