[PATCH] printk: Set console_set_on_cmdline=1 when using console="" or console=null

From: Andre Kalb
Date: Thu Jan 27 2022 - 18:01:47 EST


In case of using console="" or console=null set console_set_on_cmdline=1
to disable chosen{ "stdout-path" } node from devicetree.

To jump out from drivers/of/base.c, line 2087 of_console_check function
with false.

Signed-off-by: Andre Kalb <andre.kalb@xxxxxx>
---
kernel/printk/printk.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 82abfaf3c2aa..df5ab35b8af2 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2385,6 +2385,7 @@ static int __init console_setup(char *str)
*/
if (str[0] == 0 || strcmp(str, "null") == 0) {
__add_preferred_console("ttynull", 0, NULL, NULL, true);
+ console_set_on_cmdline = 1;
return 1;
}

--
2.31.1