From 49e86f16866fbf8e3c9a6b0770eb6f3c167f4b72 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Mon, 10 Dec 2012 09:45:12 +1030 Subject: virtio: console: don't rely on virtqueue_add_buf() returning capacity. Signed-off-by: Amit Shah Signed-off-by: Rusty Russell --- drivers/char/virtio_console.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/char') diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 8ab9c3d4bf13..89bdc31a3dc6 100644 --- a/drivers/char/virtio_console.c +++ b/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; } -- cgit v1.2.2