serial: imx: don't prepare to send if no data is available
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 2 Mar 2018 10:07:29 +0000 (11:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Mar 2018 18:21:02 +0000 (10:21 -0800)
serial_core might call the .start_tx callback without any data being
available to send. In this case return early instead of going through
all the setup needed for sending which might include disabling RX in
RS485 half-duplex mode.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c

index 80456ea2603a93ceebfb37c90fae8bfd3d1f2f7f..3a954194d2f6be01c43d8b557402fd083b2322a2 100644 (file)
@@ -651,6 +651,9 @@ static void imx_start_tx(struct uart_port *port)
        struct imx_port *sport = (struct imx_port *)port;
        u32 ucr1;
 
+       if (!sport->port.x_char && uart_circ_empty(&port->state->xmit))
+               return;
+
        if (port->rs485.flags & SER_RS485_ENABLED) {
                u32 ucr2;