summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndrew Thoelke <andrew.thoelke@arm.com>2014-06-20 11:12:39 +0100
committerAndrew Thoelke <andrew.thoelke@arm.com>2014-06-20 11:12:39 +0100
commit0695dc49e2f1fcaef673ad7a50d9ec97ae3744b5 (patch)
tree47a576f947f299ce1e498565481632dbd15de8d0 /drivers
parentdbc64b39c9193f0b582d706bcf0d04e0a7bf4944 (diff)
Remove broken assertion in console_putc()
The assertion in console_putc() would trigger a recursion that exhausts the stack and eventually aborts. This patch replaces the assertion with an error return if the console has not been initialized yet. Fixes ARM-software/tf-issues#208 Change-Id: I95f736ff215d69655eb5ba7ceac70dc1409d986a
Diffstat (limited to 'drivers')
-rw-r--r--drivers/arm/pl011/pl011_console.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/arm/pl011/pl011_console.c b/drivers/arm/pl011/pl011_console.c
index a26c00e..81897ca 100644
--- a/drivers/arm/pl011/pl011_console.c
+++ b/drivers/arm/pl011/pl011_console.c
@@ -71,7 +71,12 @@ void console_init(unsigned long base_addr)
int console_putc(int c)
{
- assert(uart_base);
+ /* If the console has not been initialized then return an error
+ * code. Asserting here would result in recursion and stack
+ * exhaustion
+ */
+ if (!uart_base)
+ return -1;
if (c == '\n') {
WAIT_UNTIL_UART_FREE(uart_base);