diff options
-rw-r--r-- | arch/sparc/kernel/prom_32.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 5881c1438198..35cb4c742524 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c | |||
@@ -198,23 +198,33 @@ static char * __init build_full_name(struct device_node *dp) | |||
198 | 198 | ||
199 | static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) | 199 | static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) |
200 | { | 200 | { |
201 | struct device_node *ret = NULL, *prev_sibling = NULL; | ||
201 | struct device_node *dp; | 202 | struct device_node *dp; |
202 | 203 | ||
203 | dp = create_node(node, parent); | 204 | while (1) { |
204 | if (dp) { | 205 | dp = create_node(node, parent); |
206 | if (!dp) | ||
207 | break; | ||
208 | |||
209 | if (prev_sibling) | ||
210 | prev_sibling->sibling = dp; | ||
211 | |||
212 | if (!ret) | ||
213 | ret = dp; | ||
214 | prev_sibling = dp; | ||
215 | |||
205 | *(*nextp) = dp; | 216 | *(*nextp) = dp; |
206 | *nextp = &dp->allnext; | 217 | *nextp = &dp->allnext; |
207 | 218 | ||
208 | dp->parent = parent; | ||
209 | dp->path_component_name = build_path_component(dp); | 219 | dp->path_component_name = build_path_component(dp); |
210 | dp->full_name = build_full_name(dp); | 220 | dp->full_name = build_full_name(dp); |
211 | 221 | ||
212 | dp->child = build_tree(dp, prom_getchild(node), nextp); | 222 | dp->child = build_tree(dp, prom_getchild(node), nextp); |
213 | 223 | ||
214 | dp->sibling = build_tree(parent, prom_getsibling(node), nextp); | 224 | node = prom_getsibling(node); |
215 | } | 225 | } |
216 | 226 | ||
217 | return dp; | 227 | return ret; |
218 | } | 228 | } |
219 | 229 | ||
220 | struct device_node *of_console_device; | 230 | struct device_node *of_console_device; |