Skip to content
Snippets Groups Projects
Commit 753812cb authored by Simon Glass's avatar Simon Glass
Browse files

dm: serial: Correct logic in serial_find_console_or_panic()


In a final attempt to find a console UART this function uses the first
first available serial device. However the check for a valid device is
inverted.

This code is only executed when there is in fact no serial UART, but at
present it can fail to reach the panic_str() call in this case, and start
trying to use a non-existent UART.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent 2fda14ae
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ static void serial_find_console_or_panic(void) ...@@ -71,7 +71,7 @@ static void serial_find_console_or_panic(void)
#endif #endif
if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) || if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) ||
!uclass_get_device(UCLASS_SERIAL, INDEX, &dev) || !uclass_get_device(UCLASS_SERIAL, INDEX, &dev) ||
(!uclass_first_device(UCLASS_SERIAL, &dev) || dev)) { (!uclass_first_device(UCLASS_SERIAL, &dev) && dev)) {
gd->cur_serial_dev = dev; gd->cur_serial_dev = dev;
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment