diff mbox series

n_gsm: Fix write handling for zero bytes written

Message ID 20200817135454.28505-1-tony@atomide.com
State New
Headers show
Series n_gsm: Fix write handling for zero bytes written | expand

Commit Message

Tony Lindgren Aug. 17, 2020, 1:54 p.m. UTC
If write returns zero we currently end up removing the message
from the queue. Instead of removing the message, we want to just
break out of the loop just like we already do for error codes.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/tty/n_gsm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -691,7 +691,8 @@  static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
 			print_hex_dump_bytes("gsm_data_kick: ",
 					     DUMP_PREFIX_OFFSET,
 					     gsm->txframe, len);
-		if (gsm->output(gsm, gsm->txframe, len) < 0)
+
+		if (gsm->output(gsm, gsm->txframe, len) <= 0)
 			break;
 		/* FIXME: Can eliminate one SOF in many more cases */
 		gsm->tx_bytes -= msg->len;