|
@@ -2643,6 +2643,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
|
|
{
|
|
|
struct uart_state *state = drv->state + uport->line;
|
|
|
struct tty_port *port = &state->port;
|
|
|
+ int ret = 0;
|
|
|
|
|
|
BUG_ON(in_interrupt());
|
|
|
|
|
@@ -2657,6 +2658,11 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
|
|
* succeeding while we shut down the port.
|
|
|
*/
|
|
|
mutex_lock(&port->mutex);
|
|
|
+ if (!state->uart_port) {
|
|
|
+ mutex_unlock(&port->mutex);
|
|
|
+ ret = -EINVAL;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
uport->flags |= UPF_DEAD;
|
|
|
mutex_unlock(&port->mutex);
|
|
|
|
|
@@ -2680,9 +2686,10 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
|
|
uport->type = PORT_UNKNOWN;
|
|
|
|
|
|
state->uart_port = NULL;
|
|
|
+out:
|
|
|
mutex_unlock(&port_mutex);
|
|
|
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/*
|