serial: 8250: 8250_core: Fix missing unlock on error in serial8250_register_8250_port()

Add the missing unlock before return from function serial8250_register_8250_port()
in the error handling case.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20190703055908.141294-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Wei Yongjun 2019-07-03 05:59:08 +00:00 committed by Greg Kroah-Hartman
parent 84872dc448
commit b7a8f76648
1 changed files with 5 additions and 2 deletions

View File

@ -1026,8 +1026,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
if (!has_acpi_companion(uart->port.dev)) { if (!has_acpi_companion(uart->port.dev)) {
gpios = mctrl_gpio_init(&uart->port, 0); gpios = mctrl_gpio_init(&uart->port, 0);
if (IS_ERR(gpios)) { if (IS_ERR(gpios)) {
if (PTR_ERR(gpios) != -ENOSYS) if (PTR_ERR(gpios) != -ENOSYS) {
return PTR_ERR(gpios); ret = PTR_ERR(gpios);
goto out_unlock;
}
} else { } else {
uart->gpios = gpios; uart->gpios = gpios;
} }
@ -1099,6 +1101,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
} }
} }
out_unlock:
mutex_unlock(&serial_mutex); mutex_unlock(&serial_mutex);
return ret; return ret;