yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
619821
From 63857964e14bbf4bcb91eaa56ca46a30d14934ed Mon Sep 17 00:00:00 2001
b28c64
From: Fam Zheng <famz@redhat.com>
619821
Date: Thu, 18 May 2017 09:21:19 +0200
b28c64
Subject: [PATCH 06/18] char/serial: Fix emptyness handling
b28c64
b28c64
RH-Author: Fam Zheng <famz@redhat.com>
619821
Message-id: <20170518092131.16571-7-famz@redhat.com>
619821
Patchwork-id: 75298
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 06/18] char/serial: Fix emptyness handling
619821
Bugzilla: 1451470
b28c64
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
619821
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
b28c64
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
b28c64
b28c64
From: Don Slutz <dslutz@verizon.com>
b28c64
b28c64
The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244
b28c64
char/serial: Fix emptyness check
b28c64
b28c64
Still causes extra NULL byte(s) to be sent.
b28c64
b28c64
So if the fifo is empty, do not send an extra NULL byte.
b28c64
b28c64
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
b28c64
Signed-off-by: Don Slutz <dslutz@verizon.com>
b28c64
Message-id: 1395160174-16006-1-git-send-email-dslutz@verizon.com
b28c64
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
b28c64
(cherry picked from commit dffacd4654ec8bf2898aed230852154c6ed755ed)
b28c64
Signed-off-by: Fam Zheng <famz@redhat.com>
b28c64
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b28c64
---
b28c64
 hw/char/serial.c | 6 ++++--
b28c64
 1 file changed, 4 insertions(+), 2 deletions(-)
b28c64
b28c64
diff --git a/hw/char/serial.c b/hw/char/serial.c
b28c64
index 489a885..e020b0e 100644
b28c64
--- a/hw/char/serial.c
b28c64
+++ b/hw/char/serial.c
b28c64
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
b28c64
 
b28c64
     if (s->tsr_retry <= 0) {
b28c64
         if (s->fcr & UART_FCR_FE) {
b28c64
-            s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
b28c64
-                        0 : fifo8_pop(&s->xmit_fifo);
b28c64
+            if (fifo8_is_empty(&s->xmit_fifo)) {
b28c64
+                return FALSE;
b28c64
+            }
b28c64
+            s->tsr = fifo8_pop(&s->xmit_fifo);
b28c64
             if (!s->xmit_fifo.num) {
b28c64
                 s->lsr |= UART_LSR_THRE;
b28c64
             }
b28c64
-- 
b28c64
1.8.3.1
b28c64