]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ppc/syslib/prom_init.c
[PATCH] ppc32: Apple device-tree bug fix
[linux-2.6-omap-h63xx.git] / arch / ppc / syslib / prom_init.c
index 2cee87137f2efa9b6efff2d25aff5c1915061464..7f15136830f4fbf38fe38e3a5418e85e51e47b96 100644 (file)
@@ -626,8 +626,18 @@ inspect_node(phandle node, struct device_node *dad,
        l = call_prom("package-to-path", 3, 1, node,
                      mem_start, mem_end - mem_start);
        if (l >= 0) {
+               char *p, *ep;
+
                np->full_name = PTRUNRELOC((char *) mem_start);
                *(char *)(mem_start + l) = 0;
+               /* Fixup an Apple bug where they have bogus \0 chars in the
+                * middle of the path in some properties
+                */
+               for (p = (char *)mem_start, ep = p + l; p < ep; p++)
+                       if ((*p) == '\0') {
+                               memmove(p, p+1, ep - p);
+                               ep--;
+                       }
                mem_start = ALIGNUL(mem_start + l + 1);
        }