Skip to contentSkip to conversation

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

PATCH In review Dan Carpenter 3 participants 3 messages Jun 28, 2016 – Aug 31, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty/serial/8250: unlock on error in serial8250_register_8250_port()

We need to unlock before returning here.

Fixes 4ef03d328769 ('tty/serial/8250: use mctrl_gpio helpers')
drivers/tty/serial/8250/8250_core.c +5 -2
index 13ad5c3..a2b849e 100644
@@ -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;
#1 lore raw
Quoted 3 lines · Dan Carpenter

We need to unlock before returning here.

Fixes 4ef03d328769 ('tty/serial/8250: use mctrl_gpio helpers')

I ended up reverting this patch, perhaps this is the problem that people were having with this patch?

thanks,

greg k-h

#2 lore raw
Quoted 9 lines · Greg Kroah-Hartman
Quoted 4 lines · Dan Carpenter

We need to unlock before returning here.

Fixes 4ef03d328769 ('tty/serial/8250: use mctrl_gpio helpers')

I ended up reverting this patch, perhaps this is the problem that people
were having with this patch?

Nope, I tried this fix, didn't help.
Mika put the details in his message I mentioned in the patch:

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy