]> git.sur5r.net Git - u-boot/commitdiff
dm: core: Fix Handling of global_data moving in SPL
authorLokesh Vutla <lokeshvutla@ti.com>
Mon, 13 Feb 2017 03:51:22 +0000 (09:21 +0530)
committerStefan Roese <sr@denx.de>
Wed, 29 Mar 2017 05:38:07 +0000 (07:38 +0200)
commit 2f11cd9121658 ("dm: core: Handle global_data moving in SPL")
handles relocation of GD in SPL if spl_init() is called before
board_init_r(). So, uclass_root.next need not be initialized always
and accessing uclass_root.next->prev gives an abort. Update the
uclass_root only if it is available.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
drivers/core/root.c

index 93ab568296809b23dab818fd0d9bdc0e78d17e98..33cfde6a5c39332c7f0df70d16893bc78cf16ffb 100644 (file)
@@ -44,8 +44,10 @@ struct udevice *dm_root(void)
 void dm_fixup_for_gd_move(struct global_data *new_gd)
 {
        /* The sentinel node has moved, so update things that point to it */
-       new_gd->uclass_root.next->prev = &new_gd->uclass_root;
-       new_gd->uclass_root.prev->next = &new_gd->uclass_root;
+       if (gd->dm_root) {
+               new_gd->uclass_root.next->prev = &new_gd->uclass_root;
+               new_gd->uclass_root.prev->next = &new_gd->uclass_root;
+       }
 }
 
 fdt_addr_t dm_get_translation_offset(void)