[PATCH] common/console.c: prevent pre-console buffer contents from being added to itself

Tom Rini trini at konsulko.com
Thu Sep 1 01:33:36 CEST 2022


On Tue, May 03, 2022 at 03:13:27PM +0200, Rasmus Villemoes wrote:

> I do not have any non-serial output devices, so a
> print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL)
> does nothing for me.
> 
> However, I was manually inspected the pre-console buffer using md.b,
> and I noticed that the early part of it was repeated. The reason is
> that the first call of print_pre_console_buffer(), from
> console_init_f(), ends up invoking puts() with the contents of the
> buffer at that point, and puts() at that point ends up in the else
> branch of
> 
> 	if (gd->flags & GD_FLG_DEVINIT) {
> 		/* Send to the standard output */
> 		fputs(stdout, s);
> 	} else {
> 		/* Send directly to the handler */
> 		pre_console_puts(s);
> 		serial_puts(s);
> 	}
> 
> so indeed the contents is added again.
> 
> That can be somewhat confusing (both when reading the buffer manually,
> but also if it did actually come out on some device). So disable all
> use of the pre-console buffer while print_pre_console_buffer() is
> emitting it.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220831/cb2fbb7f/attachment.sig>


More information about the U-Boot mailing list