]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
serial-uclass: set GD_FLG_SERIAL_READY only when cur_serial_dev is assigned
authorMaxim Kochetkov <fido_max@inbox.ru>
Wed, 13 Aug 2025 05:54:32 +0000 (08:54 +0300)
committerTom Rini <trini@konsulko.com>
Thu, 21 Aug 2025 16:02:43 +0000 (10:02 -0600)
serial_find_console_or_panic() may left cur_serial_dev unassigned if
REQUIRE_SERIAL_CONSOLE is not set. Setting GD_FLG_SERIAL_READY in
this situation confuses serial console code. It tries to use
unassigned driver instead of debug port and stops printing.
So check cur_serial_dev before setting GD_FLG_SERIAL_READY to allow
console to keep printing via debug port.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
drivers/serial/serial-uclass.c

index a08678dde4e1935255c73ca3859cc274f3f620f5..7b381ca12a09f0705dbddeed6911e18228a5cb20 100644 (file)
@@ -191,7 +191,8 @@ int serial_init(void)
 {
 #if CONFIG_IS_ENABLED(SERIAL_PRESENT)
        serial_find_console_or_panic();
-       gd->flags |= GD_FLG_SERIAL_READY;
+       if (gd->cur_serial_dev)
+               gd->flags |= GD_FLG_SERIAL_READY;
 
        if (IS_ENABLED(CONFIG_OF_SERIAL_BAUD)) {
                int ret = 0;