printk: only disable if actually unregistered

Currently in unregister_console() a printk message is generated and
the console is disabled, even it was never registered. There are
code paths (such as uart_remove_one_port()) that call
unregister_console() even if the console is not registered.

It is confusing to see messages about consoles being disabled that
were never disabled. Move the printk and disabling later, when it
is known that the console is actually registered.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
This commit is contained in:
John Ogness
2023-03-07 18:22:26 +00:00
committed by Sebastian Andrzej Siewior
parent 587e5b5882
commit 5cce771b3a
+4 -5
View File
@@ -3609,20 +3609,19 @@ static int unregister_console_locked(struct console *console)
is_boot_con = console->flags & CON_BOOT;
con_printk(KERN_INFO, console, "disabled\n");
res = _braille_unregister_console(console);
if (res < 0)
return res;
if (res > 0)
return 0;
/* Disable it unconditionally */
console_srcu_write_flags(console, console->flags & ~CON_ENABLED);
if (!console_is_registered_locked(console))
return -ENODEV;
console_srcu_write_flags(console, console->flags & ~CON_ENABLED);
con_printk(KERN_INFO, console, "disabled\n");
hlist_del_init_rcu(&console->node);
/*