summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-19 23:23:47 +0300
committerAnatolij Gustschin <agust@denx.de>2021-12-27 01:02:19 +0300
commit4057e2772d043ecfa0efc4d16bd8ab664afb69a0 (patch)
tree11faa750a4b346e7b811182e25652660665a9ab8 /common
parent250e735c692bd12ea86dcea5de2cd1cfe225a0a4 (diff)
downloadu-boot-4057e2772d043ecfa0efc4d16bd8ab664afb69a0.tar.xz
console: Avoid serial output before the console is running
The video driver uses this for debugging, but if used before relocation it crashes at present. Avoid trying to output debugging before the console is ready. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/console.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/console.c b/common/console.c
index 0c9099ca52..2bccc8ab10 100644
--- a/common/console.c
+++ b/common/console.c
@@ -348,7 +348,8 @@ static void console_puts_select(int file, bool serial_only, const char *s)
void console_puts_select_stderr(bool serial_only, const char *s)
{
- console_puts_select(stderr, serial_only, s);
+ if (gd->flags & GD_FLG_DEVINIT)
+ console_puts_select(stderr, serial_only, s);
}
static void console_puts(int file, const char *s)
@@ -401,7 +402,8 @@ static inline void console_putc(int file, const char c)
void console_puts_select(int file, bool serial_only, const char *s)
{
- if (serial_only == console_dev_is_serial(stdio_devices[file]))
+ if ((gd->flags & GD_FLG_DEVINIT) &&
+ serial_only == console_dev_is_serial(stdio_devices[file]))
stdio_devices[file]->puts(stdio_devices[file], s);
}