[patch] tty/serial/8250: unlock on error in serial8250_register_8250_port()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to unlock before returning here.

Fixes: 4ef03d328769 ('tty/serial/8250: use mctrl_gpio helpers')
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 13ad5c3..a2b849e 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1015,8 +1015,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 
 		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 unlock;
+			}
 		} else
 			uart->gpios = gpios;
 
@@ -1068,6 +1070,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 			ret = 0;
 		}
 	}
+unlock:
 	mutex_unlock(&serial_mutex);
 
 	return ret;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux