aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/lguest/lguest_device.c3
-rw-r--r--drivers/remoteproc/remoteproc_virtio.c3
-rw-r--r--drivers/s390/kvm/kvm_virtio.c3
-rw-r--r--drivers/virtio/virtio_mmio.c3
-rw-r--r--drivers/virtio/virtio_pci.c5
-rw-r--r--include/linux/virtio_config.h2
6 files changed, 18 insertions, 1 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index ccb7dfb028fa..fc92ccbd71dc 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -263,6 +263,9 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
263 struct virtqueue *vq; 263 struct virtqueue *vq;
264 int err; 264 int err;
265 265
266 if (!name)
267 return NULL;
268
266 /* We must have this many virtqueues. */ 269 /* We must have this many virtqueues. */
267 if (index >= ldev->desc->num_vq) 270 if (index >= ldev->desc->num_vq)
268 return ERR_PTR(-ENOENT); 271 return ERR_PTR(-ENOENT);
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index 343c1941c123..e7a4780e93db 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -84,6 +84,9 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev,
84 if (id >= ARRAY_SIZE(rvdev->vring)) 84 if (id >= ARRAY_SIZE(rvdev->vring))
85 return ERR_PTR(-EINVAL); 85 return ERR_PTR(-EINVAL);
86 86
87 if (!name)
88 return NULL;
89
87 ret = rproc_alloc_vring(rvdev, id); 90 ret = rproc_alloc_vring(rvdev, id);
88 if (ret) 91 if (ret)
89 return ERR_PTR(ret); 92 return ERR_PTR(ret);
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 5565af20592f..7dabef624da3 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -190,6 +190,9 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
190 if (index >= kdev->desc->num_vq) 190 if (index >= kdev->desc->num_vq)
191 return ERR_PTR(-ENOENT); 191 return ERR_PTR(-ENOENT);
192 192
193 if (!name)
194 return NULL;
195
193 config = kvm_vq_config(kdev->desc)+index; 196 config = kvm_vq_config(kdev->desc)+index;
194 197
195 err = vmem_add_mapping(config->address, 198 err = vmem_add_mapping(config->address,
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 008bf58bdaae..5d7fee385b70 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -306,6 +306,9 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
306 unsigned long flags, size; 306 unsigned long flags, size;
307 int err; 307 int err;
308 308
309 if (!name)
310 return NULL;
311
309 /* Select the queue we're interested in */ 312 /* Select the queue we're interested in */
310 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); 313 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
311 314
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index f5dfe6bdb959..42b20769d122 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -555,7 +555,10 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
555 vp_dev->per_vq_vectors = per_vq_vectors; 555 vp_dev->per_vq_vectors = per_vq_vectors;
556 allocated_vectors = vp_dev->msix_used_vectors; 556 allocated_vectors = vp_dev->msix_used_vectors;
557 for (i = 0; i < nvqs; ++i) { 557 for (i = 0; i < nvqs; ++i) {
558 if (!callbacks[i] || !vp_dev->msix_enabled) 558 if (!names[i]) {
559 vqs[i] = NULL;
560 continue;
561 } else if (!callbacks[i] || !vp_dev->msix_enabled)
559 msix_vec = VIRTIO_MSI_NO_VECTOR; 562 msix_vec = VIRTIO_MSI_NO_VECTOR;
560 else if (vp_dev->per_vq_vectors) 563 else if (vp_dev->per_vq_vectors)
561 msix_vec = allocated_vectors++; 564 msix_vec = allocated_vectors++;
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 2c4a9895379d..e2850a7ea276 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -84,7 +84,9 @@
84 * nvqs: the number of virtqueues to find 84 * nvqs: the number of virtqueues to find
85 * vqs: on success, includes new virtqueues 85 * vqs: on success, includes new virtqueues
86 * callbacks: array of callbacks, for each virtqueue 86 * callbacks: array of callbacks, for each virtqueue
87 * include a NULL entry for vqs that do not need a callback
87 * names: array of virtqueue names (mainly for debugging) 88 * names: array of virtqueue names (mainly for debugging)
89 * include a NULL entry for vqs unused by driver
88 * Returns 0 on success or error status 90 * Returns 0 on success or error status
89 * @del_vqs: free virtqueues found by find_vqs(). 91 * @del_vqs: free virtqueues found by find_vqs().
90 * @get_features: get the array of feature bits for this device. 92 * @get_features: get the array of feature bits for this device.