From eaaa69da0a591105437d883ec480a01454cf28d0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 26 Jul 2016 06:47:53 -0600 Subject: [PATCH] serial.c: Fix an error in FIONWRITE calculation --- drivers/serial/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 49d6a970b7..2b6d7ec8e5 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -946,7 +946,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) /* Determine the number of bytes waiting in the TX buffer */ - if (dev->xmit.head < dev->xmit.tail) + if (dev->xmit.tail <= dev->xmit.head) { count = dev->xmit.head - dev->xmit.tail; }