netconsole: avoid CON_ENABLED misuse to track registration
authorJohn Ogness <john.ogness@linutronix.de>
Wed, 16 Nov 2022 16:21:43 +0000 (17:27 +0106)
committerPetr Mladek <pmladek@suse.com>
Fri, 2 Dec 2022 10:25:02 +0000 (11:25 +0100)
commit2c6b4b7065a7006271a9c12b1a1e6c56dc6d3796
tree8aad1bb9826ed83570da8db6f8f3227c26b659d4
parent9490b22ab39d12a06ab60465f2c4fc6a18d99752
netconsole: avoid CON_ENABLED misuse to track registration

The CON_ENABLED flag is being misused to track whether or not the
extended console should be or has been registered. Instead use
a local variable to decide if the extended console should be
registered and console_is_registered() to determine if it has
been registered.

Also add a check in cleanup_netconsole() to only unregister the
extended console if it has been registered.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-32-john.ogness@linutronix.de
drivers/net/netconsole.c