[U-Boot] [PATCH 2/2] Add check that console is ready before output

Graeme Russ graeme.russ at gmail.com
Tue Aug 30 01:16:15 CEST 2011


Hi Simon,

On Tue, Aug 30, 2011 at 2:05 AM, Simon Glass <sjg at chromium.org> wrote:
> If puts() or printf() is called before the console is ready, U-Boot will
> either hang or die. This adds a check for this so that debug() can be used
> in early code without concern that it will hang.
>
> U-Boot boots properly
>
> Tested-by: Simon Glass <sjg at chromium.org>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>  common/console.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/common/console.c b/common/console.c
> index 8c650e0..28ddb95 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -338,7 +338,7 @@ void putc(const char c)
>        if (gd->flags & GD_FLG_DEVINIT) {
>                /* Send to the standard output */
>                fputc(stdout, c);
> -       } else {
> +       } else if (gd->have_console) {
>                /* Send directly to the handler */
>                serial_putc(c);
>        }
> @@ -359,7 +359,7 @@ void puts(const char *s)
>        if (gd->flags & GD_FLG_DEVINIT) {
>                /* Send to the standard output */
>                fputs(stdout, s);
> -       } else {
> +       } else if (gd->have_console) {
>                /* Send directly to the handler */
>                serial_puts(s);
>        }

Please have a look at my console squelching patches

Regards,

Graeme


More information about the U-Boot mailing list