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; }