qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw: virtio-gpu: remove duplicated 'virtqueue_pop'
@ 2020-08-13 15:36 Li Qiang
  2020-08-13 20:20 ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Li Qiang @ 2020-08-13 15:36 UTC (permalink / raw)
  To: mst, kraxel; +Cc: Li Qiang, liq3ea, qemu-devel

Just use 'while (true)' to avoid duplicated.
No function change.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 hw/display/virtio-gpu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 5f0dd7c150..9cef313f5e 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -869,13 +869,15 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
     }
 #endif
 
-    cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
-    while (cmd) {
+    while (true) {
+        cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
+        if (!cmd) {
+            break;
+        }
         cmd->vq = vq;
         cmd->error = 0;
         cmd->finished = false;
         QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next);
-        cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
     }
 
     virtio_gpu_process_cmdq(g);
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-17  7:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-13 15:36 [PATCH] hw: virtio-gpu: remove duplicated 'virtqueue_pop' Li Qiang
2020-08-13 20:20 ` Laszlo Ersek
2020-08-14  0:52   ` Li Qiang
2020-08-17  7:01   ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).