Browse Source

virtio: console: don't rely on virtqueue_add_buf() returning capacity.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Amit Shah 12 years ago
parent
commit
49e86f1686
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/char/virtio_console.c

+ 2 - 0
drivers/char/virtio_console.c

@@ -396,6 +396,8 @@ static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf)
 
 	ret = virtqueue_add_buf(vq, sg, 0, 1, buf, GFP_ATOMIC);
 	virtqueue_kick(vq);
+	if (!ret)
+		ret = vq->num_free;
 	return ret;
 }