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 <pty...@xes-inc.com>
Reported-by: Dennis Ruffer <daruf...@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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to