Skip to content

Commit

Permalink
serial: imx: don't prepare to send if no data is available
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Uwe Kleine-König authored and Greg Kroah-Hartman committed Mar 9, 2018
1 parent 1866541 commit 48669b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 48669b6

Please sign in to comment.