]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
serial: Use puts() and hang() instead of panic() in SPL
authorMarek Vasut <marex@denx.de>
Sat, 15 Sep 2012 08:33:51 +0000 (10:33 +0200)
committerTom Rini <trini@ti.com>
Mon, 15 Oct 2012 18:53:57 +0000 (11:53 -0700)
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>
common/serial.c

index fc38e6c2b4f52993dcf5b5198f39defa77f8a32f..acb74af963b92c0ae3bd1d22253f8c3ab758397a 100644 (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;