diff options
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 91a375fb6ae6..a65c39c473bf 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -186,6 +186,8 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, | |||
186 | */ | 186 | */ |
187 | fpsize = 1; | 187 | fpsize = 1; |
188 | allocl = 2; | 188 | allocl = 2; |
189 | l = 1; | ||
190 | *pathp = '\0'; | ||
189 | } else { | 191 | } else { |
190 | /* account for '/' and path size minus terminal 0 | 192 | /* account for '/' and path size minus terminal 0 |
191 | * already in 'l' | 193 | * already in 'l' |
@@ -198,10 +200,10 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, | |||
198 | np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl, | 200 | np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl, |
199 | __alignof__(struct device_node)); | 201 | __alignof__(struct device_node)); |
200 | if (allnextpp) { | 202 | if (allnextpp) { |
203 | char *fn; | ||
201 | memset(np, 0, sizeof(*np)); | 204 | memset(np, 0, sizeof(*np)); |
202 | np->full_name = ((char *)np) + sizeof(struct device_node); | 205 | np->full_name = fn = ((char *)np) + sizeof(*np); |
203 | if (new_format) { | 206 | if (new_format) { |
204 | char *fn = np->full_name; | ||
205 | /* rebuild full path for new format */ | 207 | /* rebuild full path for new format */ |
206 | if (dad && dad->parent) { | 208 | if (dad && dad->parent) { |
207 | strcpy(fn, dad->full_name); | 209 | strcpy(fn, dad->full_name); |
@@ -215,9 +217,9 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, | |||
215 | fn += strlen(fn); | 217 | fn += strlen(fn); |
216 | } | 218 | } |
217 | *(fn++) = '/'; | 219 | *(fn++) = '/'; |
218 | memcpy(fn, pathp, l); | 220 | } |
219 | } else | 221 | memcpy(fn, pathp, l); |
220 | memcpy(np->full_name, pathp, l); | 222 | |
221 | prev_pp = &np->properties; | 223 | prev_pp = &np->properties; |
222 | **allnextpp = np; | 224 | **allnextpp = np; |
223 | *allnextpp = &np->allnext; | 225 | *allnextpp = &np->allnext; |
@@ -459,7 +461,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, | |||
459 | 461 | ||
460 | do { | 462 | do { |
461 | u32 tag = be32_to_cpup((__be32 *)p); | 463 | u32 tag = be32_to_cpup((__be32 *)p); |
462 | char *pathp; | 464 | const char *pathp; |
463 | 465 | ||
464 | p += 4; | 466 | p += 4; |
465 | if (tag == OF_DT_END_NODE) { | 467 | if (tag == OF_DT_END_NODE) { |
@@ -487,7 +489,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, | |||
487 | pathp = (char *)p; | 489 | pathp = (char *)p; |
488 | p = ALIGN(p + strlen(pathp) + 1, 4); | 490 | p = ALIGN(p + strlen(pathp) + 1, 4); |
489 | if ((*pathp) == '/') { | 491 | if ((*pathp) == '/') { |
490 | char *lp, *np; | 492 | const char *lp, *np; |
491 | for (lp = NULL, np = pathp; *np; np++) | 493 | for (lp = NULL, np = pathp; *np; np++) |
492 | if ((*np) == '/') | 494 | if ((*np) == '/') |
493 | lp = np+1; | 495 | lp = np+1; |
@@ -710,7 +712,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
710 | */ | 712 | */ |
711 | void __init unflatten_device_tree(void) | 713 | void __init unflatten_device_tree(void) |
712 | { | 714 | { |
713 | __unflatten_device_tree(initial_boot_params, &allnodes, | 715 | __unflatten_device_tree(initial_boot_params, &of_allnodes, |
714 | early_init_dt_alloc_memory_arch); | 716 | early_init_dt_alloc_memory_arch); |
715 | 717 | ||
716 | /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */ | 718 | /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */ |