* [Qemu-devel] [PATCH v1 1/1] cadence_uart: Protect against transmit errors
@ 2016-06-21 22:05 Alistair Francis
2016-06-23 10:38 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Alistair Francis @ 2016-06-21 22:05 UTC (permalink / raw)
To: qemu-devel
Cc: alistair.francis, crosthwaitepeter, peter.maydell,
edgar.iglesias, edgar.iglesias
If qemu_chr_fe_write() returns an error (represented by a negative
number) we should skip incrementing the count and initiating a
memmove().
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/char/cadence_uart.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index c856fc3..844542f 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -288,8 +288,11 @@ static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond,
}
ret = qemu_chr_fe_write(s->chr, s->tx_fifo, s->tx_count);
- s->tx_count -= ret;
- memmove(s->tx_fifo, s->tx_fifo + ret, s->tx_count);
+
+ if (ret >= 0) {
+ s->tx_count -= ret;
+ memmove(s->tx_fifo, s->tx_fifo + ret, s->tx_count);
+ }
if (s->tx_count) {
int r = qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/1] cadence_uart: Protect against transmit errors
2016-06-21 22:05 [Qemu-devel] [PATCH v1 1/1] cadence_uart: Protect against transmit errors Alistair Francis
@ 2016-06-23 10:38 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2016-06-23 10:38 UTC (permalink / raw)
To: Alistair Francis
Cc: QEMU Developers, Peter Crosthwaite, Edgar Iglesias, Edgar E. Iglesias
On 21 June 2016 at 23:05, Alistair Francis <alistair.francis@xilinx.com> wrote:
> If qemu_chr_fe_write() returns an error (represented by a negative
> number) we should skip incrementing the count and initiating a
> memmove().
>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-23 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21 22:05 [Qemu-devel] [PATCH v1 1/1] cadence_uart: Protect against transmit errors Alistair Francis
2016-06-23 10:38 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.