diff options
author | Vladimir Senkov <hangup@gmail.com> | 2013-06-16 20:30:52 -0400 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2013-06-17 12:57:50 +0400 |
commit | b165b0d8e62bb65a02d7670d75ebb77a9280bde1 (patch) | |
tree | 4d821bcc203a147c768c083d72b24ea7aeb65dae | |
parent | 616404cd42db5f683d49772dcc2c53c8f6466024 (diff) |
char/serial: fix copy&paste error (fifo8_is_full vs empty)
Copy&paste error in serial.c causes a crash when attempting
to read from UART (if there is no data to be read)
Signed-off-by: Vladimir Senkov <hangup@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | hw/char/serial.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/char/serial.c b/hw/char/serial.c index b537e426b0..6382f98389 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -424,7 +424,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size) ret = s->divider & 0xff; } else { if(s->fcr & UART_FCR_FE) { - ret = fifo8_is_full(&s->recv_fifo) ? + ret = fifo8_is_empty(&s->recv_fifo) ? 0 : fifo8_pop(&s->recv_fifo); if (s->recv_fifo.num == 0) { s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); |