All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Michael Walle <michael@walle.cc>
Cc: Frank Rowand <frowand.list@gmail.com>,
	linux-serial@vger.kernel.org, Jiri Slaby <jirislaby@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2] earlycon: prevent multiple register_console()
Date: Thu, 2 Jun 2022 09:29:59 -0500	[thread overview]
Message-ID: <20220602142959.GA2256623-robh@kernel.org> (raw)
In-Reply-To: <20220602090038.3201897-1-michael@walle.cc>

On Thu, 02 Jun 2022 11:00:38 +0200, Michael Walle wrote:
> If the earlycon parameter is given twice, the kernel will spit out a
> WARN() in register_console() because it was already registered. The
> non-dt variant setup_earlycon() already handles that gracefully. The dt
> variant of_setup_earlycon() doesn't. Add the check there and add the
> -EALREADY handling in early_init_dt_scan_chosen_stdout().
> 
> FWIW, this doesn't happen if CONFIG_ACPI_SPCR_TABLE is set. In that case
> the registration is delayed until after earlycon parameter(s) are
> parsed.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> changes since v1:
>  - add missing EALREADY handling in of_setup_earlycon()
>  - return 0 early as suggested by Rob
> 
> For the curious, here is the backtrace:
> 
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] WARNING: CPU: 0 PID: 0 at kernel/printk/printk.c:3328 register_console+0x2b4/0x364
> [    0.000000] console 'atmel_serial0' already registered
> [    0.000000] Modules linked in:
> [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-next-20220601+ #652
> [    0.000000] Hardware name: Generic DT based system
> [    0.000000] Backtrace:
> [    0.000000]  dump_backtrace from show_stack+0x18/0x1c
> [    0.000000]  show_stack from dump_stack_lvl+0x48/0x54
> [    0.000000]  dump_stack_lvl from dump_stack+0x18/0x1c
> [    0.000000]  dump_stack from __warn+0xd0/0x148
> [    0.000000]  __warn from warn_slowpath_fmt+0x9c/0xc4
> [    0.000000]  warn_slowpath_fmt from register_console+0x2b4/0x364
> [    0.000000]  register_console from of_setup_earlycon+0x29c/0x2ac
> [    0.000000]  of_setup_earlycon from early_init_dt_scan_chosen_stdout+0x154/0x18c
> [    0.000000]  early_init_dt_scan_chosen_stdout from param_setup_earlycon+0x40/0x48
> [    0.000000]  param_setup_earlycon from do_early_param+0x88/0xc4
> [    0.000000]  do_early_param from parse_args+0x1a4/0x404
> [    0.000000]  parse_args from parse_early_options+0x40/0x48
> [    0.000000]  parse_early_options from parse_early_param+0x38/0x48
> [    0.000000]  parse_early_param from setup_arch+0x114/0x7a4
> [    0.000000]  setup_arch from start_kernel+0x74/0x6dc
> [    0.000000]  start_kernel from 0x0
> [    0.000000] ---[ end trace 0000000000000000 ]---
> 
>  drivers/of/fdt.c              | 4 +++-
>  drivers/tty/serial/earlycon.c | 3 +++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

  reply	other threads:[~2022-06-02 14:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  9:00 [PATCH v2] earlycon: prevent multiple register_console() Michael Walle
2022-06-02 14:29 ` Rob Herring [this message]
2022-06-28 11:21 ` Michael Walle
2022-06-28 11:55   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220602142959.GA2256623-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.