Thread (21 messages) 21 messages, 2 authors, 2021-11-18
STALE1713d LANDED

[PATCH 16/19] mxser: increase buf_overrun if tty_insert_flip_char() fails

From: Jiri Slaby <hidden>
Date: 2021-11-18 07:32:52
Also in: lkml
Subsystem: moxa smartio/industio/intellio serial card, the rest, tty layer and serial drivers · Maintainers: Jiri Slaby, Linus Torvalds, Greg Kroah-Hartman

mxser doesn't increase port->icount.buf_overrun at all. Do so if overrun
happens, so that it can be read from the stats.

Signed-off-by: Jiri Slaby <redacted>
---
 drivers/tty/mxser.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 10862d4bb885..65ea4baee5eb 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1507,7 +1507,8 @@ static bool mxser_receive_chars_new(struct mxser_port *port, u8 status)
 
 	while (gdl--) {
 		u8 ch = inb(port->ioaddr + UART_RX);
-		tty_insert_flip_char(&port->port, ch, 0);
+		if (!tty_insert_flip_char(&port->port, ch, 0))
+			port->icount.buf_overrun++;
 	}
 
 	return true;
@@ -1553,8 +1554,10 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,
 					port->icount.overrun++;
 				}
 			}
-			if (!tty_insert_flip_char(&port->port, ch, flag))
+			if (!tty_insert_flip_char(&port->port, ch, flag)) {
+				port->icount.buf_overrun++;
 				break;
+			}
 		}
 
 		if (hwid)
-- 
2.33.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help