uart_register_driver() returned -ENOMEM on any error, even when tty_register_driver() call returned another one, such as -EBUSY. Signed-off-by: Sergey Organov <sorganov@xxxxxxxxx> --- drivers/tty/serial/serial_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 351843f..2ce8157 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2505,7 +2505,7 @@ static const struct tty_port_operations uart_port_ops = { int uart_register_driver(struct uart_driver *drv) { struct tty_driver *normal; - int i, retval; + int i, retval = -ENOMEM; BUG_ON(drv->state); @@ -2557,7 +2557,7 @@ int uart_register_driver(struct uart_driver *drv) out_kfree: kfree(drv->state); out: - return -ENOMEM; + return retval; } /** -- 2.10.0.1.g57b01a3