Separate out a non-changing condition over the period of a loop into an if statement before the loop. This will be used later to re-work the loop.
Signed-off-by: Amit Shah <amit.s...@redhat.com> --- hw/virtio-serial-bus.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 74ba5ec..ecf0056 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -121,7 +121,10 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq, assert(port || discard); assert(virtio_queue_ready(vq)); - while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) { + if (!discard && port->throttled) { + return; + } + while (virtqueue_pop(vq, &elem)) { uint8_t *buf; size_t ret, buf_size; -- 1.7.3.2