fdt_support: skip MTD node with "disabled" in fdt_fixup_mtdparts()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 17 Jul 2020 01:46:19 +0000 (10:46 +0900)
committerSimon Glass <sjg@chromium.org>
Sat, 25 Jul 2020 20:46:57 +0000 (14:46 -0600)
Currently, fdt_fixup_mtdparts() only checks the compatible property.
It is pointless to fix up the disabled node.

Skip the node if it has the property:

  status = "disabled"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/fdt_support.c

index 9c84702b19e067efd9bcc4de6d46b50b5447dc6b..a565b470f81ee55caf87971c765269c81e13cd3d 100644 (file)
@@ -955,9 +955,16 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
 
        for (i = 0; i < node_info_size; i++) {
                idx = 0;
-               noff = fdt_node_offset_by_compatible(blob, -1,
-                                                    node_info[i].compat);
-               while (noff != -FDT_ERR_NOTFOUND) {
+               noff = -1;
+
+               while ((noff = fdt_node_offset_by_compatible(blob, noff,
+                                               node_info[i].compat)) >= 0) {
+                       const char *prop;
+
+                       prop = fdt_getprop(blob, noff, "status", NULL);
+                       if (prop && !strcmp(prop, "disabled"))
+                               continue;
+
                        debug("%s: %s, mtd dev type %d\n",
                                fdt_get_name(blob, noff, 0),
                                node_info[i].compat, node_info[i].type);
@@ -973,10 +980,6 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
                                if (fdt_node_set_part_info(blob, noff, dev))
                                        return; /* return on error */
                        }
-
-                       /* Jump to next flash node */
-                       noff = fdt_node_offset_by_compatible(blob, noff,
-                                                            node_info[i].compat);
                }
        }
 }