On Tue, May 05, 2020 at 04:42:01PM +0200, Lukas Wunner wrote: > If the call to uart_add_one_port() in serial8250_register_8250_port() > fails, a half-initialized entry in the serial_8250ports[] array is left > behind. > > A subsequent reprobe of the same serial port causes that entry to be > reused. Because uart->port.dev is set, uart_remove_one_port() is called > for the half-initialized entry and bails out with an error message: > > bcm2835-aux-uart 3f215040.serial: Removing wrong port: (null) != (ptrval) > > The same happens on failure of mctrl_gpio_init() since commit > 4a96895f74c9 ("tty/serial/8250: use mctrl_gpio helpers"). > > Fix by zeroing the uart->port.dev pointer in the probe error path. Fixes tag? > Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> > Cc: stable@xxxxxxxxxxxxxxx # v2.6.10+ ... > ret = uart_add_one_port(&serial8250_reg, > &uart->port); > - if (ret == 0) > + if (ret) > + goto err; > + else Redundant. > ret = uart->port.line; -- With Best Regards, Andy Shevchenko