]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
serial: 8250: 8250_core: Fix missing unlock on error in serial8250_register_8250_port()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 3 Jul 2019 05:59:08 +0000 (05:59 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2019 17:28:40 +0000 (19:28 +0200)
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>
drivers/tty/serial/8250/8250_core.c

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