]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - lib/fdtdec.c
linux_compat: handle __GFP_ZERO in kmalloc()
[karo-tx-uboot.git] / lib / fdtdec.c
index 9c6b3619da24cd9ad5c4894d848298ff380d3419..232ca7471215aa08e47fd52b7b9d472b57f25cb7 100644 (file)
@@ -505,8 +505,7 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
                const char *prop;
                const char *name;
                const char *slash;
-               const char *p;
-               int len;
+               int len, val;
 
                prop = fdt_getprop_by_offset(blob, prop_offset, &name, &len);
                debug("   - %s, %s\n", name, prop);
@@ -517,12 +516,11 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
                slash = strrchr(prop, '/');
                if (strcmp(slash + 1, find_name))
                        continue;
-               for (p = name + strlen(name) - 1; p > name; p--) {
-                       if (!isdigit(*p)) {
-                               *seqp = simple_strtoul(p + 1, NULL, 10);
-                               debug("Found seq %d\n", *seqp);
-                               return 0;
-                       }
+               val = trailing_strtol(name);
+               if (val != -1) {
+                       *seqp = val;
+                       debug("Found seq %d\n", *seqp);
+                       return 0;
                }
        }
 
@@ -570,6 +568,13 @@ int fdtdec_prepare_fdt(void)
                puts("Missing DTB\n");
 #else
                puts("No valid device tree binary found - please append one to U-Boot binary, use u-boot-dtb.bin or define CONFIG_OF_EMBED. For sandbox, use -d <file.dtb>\n");
+# ifdef DEBUG
+               if (gd->fdt_blob) {
+                       printf("fdt_blob=%p\n", gd->fdt_blob);
+                       print_buffer((ulong)gd->fdt_blob, gd->fdt_blob, 4,
+                                    32, 0);
+               }
+# endif
 #endif
                return -1;
        }