From: Marek Vasut Date: Mon, 17 Sep 2012 01:21:30 +0200 Subject: [U-Boot] [PATCH 65/71] serial: Use puts() and hang() instead of panic() in SPL In-Reply-To: <1347837696-3192-1-git-send-email-marex@denx.de> References: <1347837696-3192-1-git-send-email-marex@denx.de> Message-ID: <1347837696-3192-66-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Marek Vasut Cc: Tom Rini --- common/serial.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/serial.c b/common/serial.c index cef4ba8..8e0d8a1 100644 --- a/common/serial.c +++ b/common/serial.c @@ -230,8 +230,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; -- 1.7.10.4