aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_pci.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 4bcc8b82640..79a31e5b4b6 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -415,9 +415,13 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
415 } 415 }
416 } 416 }
417 417
418 spin_lock_irqsave(&vp_dev->lock, flags); 418 if (callback) {
419 list_add(&info->node, &vp_dev->virtqueues); 419 spin_lock_irqsave(&vp_dev->lock, flags);
420 spin_unlock_irqrestore(&vp_dev->lock, flags); 420 list_add(&info->node, &vp_dev->virtqueues);
421 spin_unlock_irqrestore(&vp_dev->lock, flags);
422 } else {
423 INIT_LIST_HEAD(&info->node);
424 }
421 425
422 return vq; 426 return vq;
423 427