Re: [PATCH v4 4/4] serial: 8250: Add preferred console in serial8250_isa_init_ports()

From: Andy Shevchenko
Date: Tue Dec 05 2023 - 11:08:48 EST


On Tue, Dec 05, 2023 at 09:32:36AM +0200, Tony Lindgren wrote:
> Prepare 8250 isa ports to drop kernel command line serial console

ISA

> handling from console_setup().
>
> We need to set the preferred console in serial8250_isa_init_ports().
> Otherwise the console gets initialized only later on when the hardware
> specific driver takes over, and console_setup() is no longer handling
> the ttyS related quirks.
>
> Note that this mostly affects x86 as this happens based on define
> SERIAL_PORT_DFNS.

...

> +static void __init serial8250_isa_init_preferred_console(int idx)
> +{
> + const char *name __free(kfree);
> + int ret;
> +
> + name = kasprintf(GFP_KERNEL, "%s%i", serial8250_reg.dev_name, idx);

No error check?

> + ret = add_preferred_console_match(name, serial8250_reg.dev_name, idx);
> + if (!ret || ret == -ENOENT)
> + return;

ret = serial_base_add_one_prefcon(...);

?

> + pr_err("Could not add preferred console for %s idx %i\n",
> + serial8250_reg.dev_name, idx);
> +}

--
With Best Regards,
Andy Shevchenko