Re: [PATCH v2] printk: Set console_set_on_cmdline=1 when __add_preferred_console() is called with user_specified == true

Sergey Senozhatsky
2022-02-15T03:16:09Z

On (22/02/14 14:21), Andre Kalb wrote:
> +static void set_user_specified(struct console_cmdline *c, bool user_specified)
> +{
> + if (!user_specified)
> + return;
> +
> + c->user_specified = true;
> + console_set_on_cmdline = 1;
> +}

In original code we always set c->user_specified. Is it guaranteed that
->user_specified is properly initialized to 0? Maybe can do something like:

static void set_user_specified(struct console_cmdline *c, bool user_specified)
{
c->user_specified = user_specified;

if (!user_specified)
return;

console_set_on_cmdline = 1;
}