[U-Boot] [PATCH] dm: core: Fix Handling global_data moving in SPL
Lokesh Vutla
lokeshvutla at ti.com
Fri Feb 10 13:41:04 UTC 2017
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(). But it is not necessary that spl_init() is not
always called before board_init_r(). So, uclass_root.next might
not be initialized and accessing uclass_root.next->prev gives
an abort. Update the uclass_root only if it is available.
Signed-off-by: Lokesh Vutla <lokeshvutla at ti.com>
---
- I encountered this problem when trying to enable SPL_DM on AM43xx
devices.
drivers/core/root.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 9edfc1efb6..8d570f3f78 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -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 (new_gd->uclass_root.next)
+ new_gd->uclass_root.next->prev = &new_gd->uclass_root;
+ if (new_gd->uclass_root.prev)
+ new_gd->uclass_root.prev->next = &new_gd->uclass_root;
}
fdt_addr_t dm_get_translation_offset(void)
--
2.11.0
More information about the U-Boot
mailing list