diff mbox series

[01/11] drm/virtio: fix a wait_event condition

Message ID 20200205181955.202485-2-olvaffe@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/virtio: fixes and cleanups for vbuf queuing | expand

Commit Message

Chia-I Wu Feb. 5, 2020, 6:19 p.m. UTC
outcnt may be greater than 1 since commit e1218b8c0cc1 (drm/virtio:
Use vmalloc for command buffer allocations.).

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Cc: David Riley <davidriley@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 5914e79d3429f..5169e8dd9fd6c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -391,7 +391,8 @@  static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
 	 */
 	if (vq->num_free < 2 + outcnt) {
 		spin_unlock(&vgdev->ctrlq.qlock);
-		wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= 3);
+		wait_event(vgdev->ctrlq.ack_queue,
+			   vq->num_free >= 2 + outcnt);
 		goto again;
 	}