Skip to content

Commit f873efe

Browse files
committed
printk/console: Remove unnecessary need_default_console manipulation
There is no need to clear @need_default_console when a console preferred by the command line, device tree, or SPCR, gets enabled. The code is called only when some non-braille console matched a console in @console_cmdline array. It means that a non-braille console was added in __add_preferred_console() and the variable preferred_console is set to a number >= 0. As a result, @need_default_console is always set to "false" in the magic condition: if (need_default_console || bcon || !console_drivers) need_default_console = preferred_console < 0; This is one small step in removing the above magic condition that is hard to follow. The patch removes one superfluous assignment and should not change the functionality. Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a695337 commit f873efe

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

kernel/printk/printk.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,10 +2892,8 @@ static int try_enable_preferred_console(struct console *newcon,
28922892
return err;
28932893
}
28942894
newcon->flags |= CON_ENABLED;
2895-
if (i == preferred_console) {
2895+
if (i == preferred_console)
28962896
newcon->flags |= CON_CONSDEV;
2897-
need_default_console = false;
2898-
}
28992897
return 0;
29002898
}
29012899

0 commit comments

Comments
 (0)