board_f: Drop the timer after relocation
authorSimon Glass <sjg@chromium.org>
Wed, 6 Sep 2017 01:49:45 +0000 (19:49 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Sat, 16 Sep 2017 06:57:44 +0000 (14:57 +0800)
Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
common/board_f.c

index 104d144f41ab3703db74d20609507bd3bb38b8a4..9220815441e51f58d34eac914c570a84da206bd1 100644 (file)
@@ -952,6 +952,9 @@ void board_init_f_r(void)
         * UART if available.
         */
        gd->flags &= ~GD_FLG_SERIAL_READY;
+#ifdef CONFIG_TIMER
+       gd->timer = NULL;
+#endif
 
        /*
         * U-Boot has been copied into SDRAM, the BSS has been cleared etc.