From: Tom Rini Date: Sun, 7 Jul 2019 21:15:48 -0400 Subject: [U-Boot] [PATCH v2 1/3] board_r: move initr_watchdog to be called after initr_serial In-Reply-To: <1557998353-13917-1-git-send-email-weijie.gao@mediatek.com> References: <1557998353-13917-1-git-send-email-weijie.gao@mediatek.com> Message-ID: <20190708011548.GB8554@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, May 16, 2019 at 05:19:13PM +0800, Weijie Gao wrote: > The initr_watchdog is currently placed before initr_serial. The > initr_watchdog calls printf and printf finally calls ops->putc of a serial > driver. > > However, gd->cur_serial_dev points to a udevice allocated in board_f. The > gd->cur_serial_dev->driver->ops->putc points the the code region before > relocation. > > Some serial drivers call WATCHDOG_RESET() in ops->putc. When DM is enabled > for watchdog, watchdog_reset() is called. watchdog_reset() calls get_timer > to get current timer. > > On some platforms the timer driver is also a DM driver. initr_watchdog is > placed right after initr_dm, which means the timer driver hasn't been > initialized. So dm_timer_init() is called. To create a new udevice, calloc > is called. > > However start from ops->putc, u-boot execution flow is redirected into the > memory region before relocation (board_f). In board_f, dlmalloc hasn't > been initialized. The call to calloc will fail, and this will cause DM to > print out an error message, and it will call printf again, causing > recursive error outputs. > > This patch places initr_watchdog after initr_serial to solve this issue. > > Cc: Stefan Roese > Reviewed-by: Ryder Lee > Signed-off-by: Weijie Gao > Reviewed-by: Stefan Roese > Tested-by: Frank Wunderlich > Tested-by: Suniel Mahesh Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: