[U-Boot] [PATCH] logbuff: Prevent an infinite loop for console output
Peter Tyser
ptyser at xes-inc.com
Fri May 7 02:32:02 CEST 2010
When using 'logbuff' as stdout and the console loglevel is greater
than a message's loglevel it is supposed to be both logged, and printed
to the console. The logbuff_printk() function is responsible for both
logging and displaying the message. However, logbuff_printk()
previously used printf() to print the message to the console. The
printf() call would eventually end up back in logbuff_printk(), and
an infinite loop would occur which would hang a board.
Using serial_puts() instead of printf() in logbuff_printk() avoids the
recursion and resolves the issue.
Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
Reported-by: Dennis Ruffer <daruffer at gmail.com>
---
common/cmd_log.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/common/cmd_log.c b/common/cmd_log.c
index e3ebe96..baffeb1 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -313,9 +313,10 @@ static int logbuff_printk(const char *line)
break;
}
}
- if (msg_level < console_loglevel) {
- printf("%s", msg);
- }
+
+ if (msg_level < console_loglevel)
+ serial_puts(msg);
+
if (line_feed)
msg_level = -1;
}
--
1.6.2.1
More information about the U-Boot
mailing list