Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wei Yongjun and committed by
Greg Kroah-Hartman
b7a8f766 84872dc4

+5 -2
+5 -2
drivers/tty/serial/8250/8250_core.c
··· 1026 1026 if (!has_acpi_companion(uart->port.dev)) { 1027 1027 gpios = mctrl_gpio_init(&uart->port, 0); 1028 1028 if (IS_ERR(gpios)) { 1029 - if (PTR_ERR(gpios) != -ENOSYS) 1030 - return PTR_ERR(gpios); 1029 + if (PTR_ERR(gpios) != -ENOSYS) { 1030 + ret = PTR_ERR(gpios); 1031 + goto out_unlock; 1032 + } 1031 1033 } else { 1032 1034 uart->gpios = gpios; 1033 1035 } ··· 1101 1099 } 1102 1100 } 1103 1101 1102 + out_unlock: 1104 1103 mutex_unlock(&serial_mutex); 1105 1104 1106 1105 return ret;