Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331412
b: refs/heads/master
c: d78b519
h: refs/heads/master
v: v3
  • Loading branch information
Brian Foley authored and Rusty Russell committed Sep 28, 2012
1 parent ea89813 commit 364f820
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3850d29fc40f3494a3e9c3aac45b6afe53526449
refs/heads/master: d78b519f6b945aef6202bbb5b56f928572e15165
10 changes: 10 additions & 0 deletions trunk/drivers/virtio/virtio_mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,16 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
* and two rings (which makes it "alignment_size * 2")
*/
info->num = readl(vm_dev->base + VIRTIO_MMIO_QUEUE_NUM_MAX);

/* If the device reports a 0 entry queue, we won't be able to
* use it to perform I/O, and vring_new_virtqueue() can't create
* empty queues anyway, so don't bother to set up the device.
*/
if (info->num == 0) {
err = -ENOENT;
goto error_alloc_pages;
}

while (1) {
size = PAGE_ALIGN(vring_size(info->num,
VIRTIO_MMIO_VRING_ALIGN));
Expand Down

0 comments on commit 364f820

Please sign in to comment.