summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/8250/8250_mxpcie.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/8250/8250_mxpcie.c')
-rw-r--r--drivers/tty/serial/8250/8250_mxpcie.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c
index a4e45e3923ae..0a3fb63991c1 100644
--- a/drivers/tty/serial/8250/8250_mxpcie.c
+++ b/drivers/tty/serial/8250/8250_mxpcie.c
@@ -412,7 +412,7 @@ static int mxpcie8250_handle_irq(struct uart_port *port)
static void mxpcie8250_software_break_ctl(struct uart_port *port, int break_state)
{
struct uart_8250_port *up = up_to_u8250p(port);
- struct tty_struct *tty = port->state->port.tty;
+ struct tty_struct *tty;
unsigned int baud, quot;
u8 sfr, tx_byte = 0x01;
@@ -439,9 +439,14 @@ static void mxpcie8250_software_break_ctl(struct uart_port *port, int break_stat
serial_out(up, UART_FCR, UART_FCR_CLEAR_XMIT);
- baud = tty_get_baud_rate(tty);
- quot = uart_get_divisor(port, baud);
- serial8250_do_set_divisor(port, baud, quot);
+ /* A hangup during the break detaches the tty */
+ tty = tty_port_tty_get(&port->state->port);
+ if (tty) {
+ baud = tty_get_baud_rate(tty);
+ quot = uart_get_divisor(port, baud);
+ serial8250_do_set_divisor(port, baud, quot);
+ tty_kref_put(tty);
+ }
serial_out(up, UART_LCR, up->lcr);
}
}