drivers: core: nullify gd->dm_root after dm_uninit()
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Fri, 7 Dec 2018 13:50:54 +0000 (14:50 +0100)
committerHeiko Schocher <hs@denx.de>
Mon, 10 Dec 2018 06:23:45 +0000 (07:23 +0100)
To reset the DM after a new dtb is loaded, we need to call dm_uninit()
and then dm_init(). This fails however because gd->dm_root is not nullified
by dm_uninit().
Fixing it by setting gd->dm_root in dm_uninit().

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/core/root.c

index 4ce55f9cc890d1726f98f3048cd6aec24d03d60d..e6ec7faf3792c55b428923f71f2d73e46222a94d 100644 (file)
@@ -187,6 +187,7 @@ int dm_uninit(void)
 {
        device_remove(dm_root(), DM_REMOVE_NORMAL);
        device_unbind(dm_root());
+       gd->dm_root = NULL;
 
        return 0;
 }