]> git.baikalelectronics.ru Git - kernel.git/commit
earlycon: prevent multiple register_console()
authorMichael Walle <michael@walle.cc>
Tue, 28 Jun 2022 12:07:05 +0000 (14:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jun 2022 15:10:11 +0000 (17:10 +0200)
commit46d0646c4c97208670590a2270db5d3fc7446d50
treea91e8dfd80a9b4167a3def1a54176e803e3d8ca0
parent95c1bb8485b7d981d6359842ddfaedc7b540d005
earlycon: prevent multiple register_console()

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.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20220628120705.200617-1-michael@walle.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/fdt.c
drivers/tty/serial/earlycon.c