summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2012-10-06 14:07:04 +0000
committerTom Rini <trini@ti.com>2012-10-17 07:55:51 -0700
commitdee1941604ca0970f455b8231f695bcdb67045e4 (patch)
tree5660152c880a3d41c6461c180d1f3c432409fac2
parent6d93e25806337d46ee75c6703b3ecc972cb179a5 (diff)
serial: Reorder get_current()
Reorder the get_current() function to make it a bit more readable. The code does not grow and there is minor change in the code logic, where dev != NULL is now checked in any case. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com>
-rw-r--r--drivers/serial/serial.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 3ab323bcb8..18b9ed4330 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -227,20 +227,23 @@ static struct serial_device *get_current(void)
{
struct serial_device *dev;
- if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+ if (!(gd->flags & GD_FLG_RELOC))
dev = default_serial_console();
+ else if (!serial_current)
+ dev = default_serial_console();
+ else
+ dev = serial_current;
- /* We must have a console device */
- if (!dev) {
+ /* We must have a console device */
+ if (!dev) {
#ifdef CONFIG_SPL_BUILD
- puts("Cannot find console\n");
- hang();
+ puts("Cannot find console\n");
+ hang();
#else
- panic("Cannot find console\n");
+ panic("Cannot find console\n");
#endif
- }
- } else
- dev = serial_current;
+ }
+
return dev;
}