Patchwork cadence_uart: Handle backend tx errors

login
register
mail settings
Submitter Edgar Iglesias
Date June 18, 2013, 10:14 a.m.
Message ID <1371550451-28150-1-git-send-email-edgar.iglesias@gmail.com>
Download mbox | patch
Permalink /patch/252221/
State New
Headers show

Comments

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

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