summaryrefslogtreecommitdiff
path: root/drivers/serial/serial-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-07-31 09:31:20 -0600
committerSimon Glass <sjg@chromium.org>2015-08-05 08:42:40 -0600
commit753812cb2eccf18f0f1537fd1a5dd9659b60a505 (patch)
tree02b3649842a613a4d3566fdef5385af4c8819ebc /drivers/serial/serial-uclass.c
parent2fda14ae6aa36798b59ab0591a2009ead206159b (diff)
downloadu-boot-imx-753812cb2eccf18f0f1537fd1a5dd9659b60a505.zip
u-boot-imx-753812cb2eccf18f0f1537fd1a5dd9659b60a505.tar.gz
u-boot-imx-753812cb2eccf18f0f1537fd1a5dd9659b60a505.tar.bz2
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: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/serial/serial-uclass.c')
-rw-r--r--drivers/serial/serial-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 815fec3..bbc366b 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -71,7 +71,7 @@ static void serial_find_console_or_panic(void)
#endif
if (!uclass_get_device_by_seq(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;
return;
}