]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ppc64/kernel/prom_init.c
[PATCH] ppc64: Fix a device-tree bug on Apple's
[linux-2.6-omap-h63xx.git] / arch / ppc64 / kernel / prom_init.c
index bc53967a86436d6b3f4a4f324273e01fdab934b3..3de950de3671d293fc0e9d6a74bf8b0059b0d06f 100644 (file)
@@ -1566,7 +1566,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
 {
        int l, align;
        phandle child;
-       char *namep, *prev_name, *sstart;
+       char *namep, *prev_name, *sstart, *p, *ep;
        unsigned long soff;
        unsigned char *valp;
        unsigned long offset = reloc_offset();
@@ -1588,6 +1588,14 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
                        call_prom("package-to-path", 3, 1, node, namep, l);
                }
                namep[l] = '\0';
+               /* Fixup an Apple bug where they have bogus \0 chars in the
+                * middle of the path in some properties
+                */
+               for (p = namep, ep = namep + l; p < ep; p++)
+                       if (*p == '\0') {
+                               memmove(p, p+1, ep - p);
+                               ep--; l--;
+                       }
                *mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4);
        }