cadence_uart: Handle backend tx errors

Submitted by Edgar Iglesias on June 18, 2013, 10:14 a.m.

Details

Message ID 1371550451-28150-1-git-send-email-edgar.iglesias@gmail.com
State New
Headers show

Commit Message

Edgar Iglesias June 18, 2013, 10:14 a.m.
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
 hw/char/cadence_uart.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index c2a7834..2219a0e 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -298,7 +298,12 @@  static void uart_write_tx_fifo(UartState *s, const uint8_t *buf, int size)
     }
 
     while (size) {
-        size -= qemu_chr_fe_write(s->chr, buf, size);
+        int r;
+        r = qemu_chr_fe_write_all(s->chr, buf, size);
+        if (r < 0) {
+            break;
+        }
+        size -= r;
     }
 }