summaryrefslogtreecommitdiff
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2012-12-10 09:45:12 +1030
committerRusty Russell <rusty@rustcorp.com.au>2012-12-18 15:20:34 +1030
commit49e86f16866fbf8e3c9a6b0770eb6f3c167f4b72 (patch)
tree3979a5769d8f03d723b306f7f5bdbcb3e5d0a81e /drivers/char/virtio_console.c
parent9ed4cb073438e2154778f0d693d966359afd6549 (diff)
downloadlinux-next-49e86f16866fbf8e3c9a6b0770eb6f3c167f4b72.tar.gz
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>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c2
1 files changed, 2 insertions, 0 deletions
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;
}