serial: Use puts() and hang() instead of panic() in SPL

If case the get_current() call fails before relocation, the U-Boot
must try to print an error message, fail and either reset or halt.
Such error is critical enough to halt the system, as it means the
system is in very bad state.

This is now also used in SPL, since CONFIG_SERIAL_MULTI is enabled
unconditionally. To avoid compiling whole vsprintf.c into SPL, use
puts() to print error message and hang() to stop the system in case
of SPL build.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
This commit is contained in:
Marek Vasut 2012-09-15 10:33:51 +02:00 committed by Tom Rini
parent 320de1354f
commit f1f1e9cb73

View File

@ -222,8 +222,14 @@ static struct serial_device *get_current(void)
dev = default_serial_console();
/* We must have a console device */
if (!dev)
panic("Cannot find console");
if (!dev) {
#ifdef CONFIG_SPL_BUILD
puts("Cannot find console\n");
hang();
#else
panic("Cannot find console\n");
#endif
}
} else
dev = serial_current;
return dev;