[U-Boot] [PATCH] logbuff: Prevent an infinite loop for console output

Detlev Zundel dzu at denx.de
Fri May 7 10:23:56 CEST 2010


Hi Peter,

> 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>

Hm.  What if a board has "stdout" set to "lcd" or "nc" or any other
device?  Do we really want the text to be output on the serial console
then?  Doesn't this break the whole "stdout" concept?

Cheers
  Detlev

-- 
Some people unfortunately like  jumping up and down about spaces but not code.
[...]   I'd rather read good poetry written in very bad hand writing than bad
poetry written in beautiful handwriting, and I think the same is true of code.
           -- Alan Cox <20090701130018.115ce0ea at lxorguk.ukuu.org.uk>
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list