serial: simplify tsr_retry reset
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Jun 2016 12:20:50 +0000 (14:20 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 29 Jun 2016 12:03:47 +0000 (14:03 +0200)
Move common code outside the if, and reset tsr_retry even in loopback mode.
Right now it cannot become non-zero, but it will be possible as soon as
we start respecting the baud rate.

Tested-by: Bret Ketchum <bcketchum@gmail.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/char/serial.c

index e65e9e0b4c30d40e4cc8ad82df1acd7aaa310f06..904b218c21138267024ad9d6e83963429faa145d 100644 (file)
@@ -258,10 +258,8 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
                 s->tsr_retry++;
                 return FALSE;
             }
-            s->tsr_retry = 0;
-        } else {
-            s->tsr_retry = 0;
         }
+        s->tsr_retry = 0;
 
         /* Transmit another byte if it is already available. It is only
            possible when FIFO is enabled and not empty. */