aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_pci_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio/virtio_pci_common.c')
-rw-r--r--drivers/virtio/virtio_pci_common.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index df548a6fb844..590534910dc6 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -147,7 +147,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
147{ 147{
148 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 148 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
149 const char *name = dev_name(&vp_dev->vdev.dev); 149 const char *name = dev_name(&vp_dev->vdev.dev);
150 int i, err = -ENOMEM, allocated_vectors, nvectors; 150 int i, j, err = -ENOMEM, allocated_vectors, nvectors;
151 unsigned flags = PCI_IRQ_MSIX; 151 unsigned flags = PCI_IRQ_MSIX;
152 bool shared = false; 152 bool shared = false;
153 u16 msix_vec; 153 u16 msix_vec;
@@ -212,7 +212,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
212 if (!vp_dev->msix_vector_map) 212 if (!vp_dev->msix_vector_map)
213 goto out_disable_config_irq; 213 goto out_disable_config_irq;
214 214
215 allocated_vectors = 1; /* vector 0 is the config interrupt */ 215 allocated_vectors = j = 1; /* vector 0 is the config interrupt */
216 for (i = 0; i < nvqs; ++i) { 216 for (i = 0; i < nvqs; ++i) {
217 if (!names[i]) { 217 if (!names[i]) {
218 vqs[i] = NULL; 218 vqs[i] = NULL;
@@ -236,18 +236,19 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
236 continue; 236 continue;
237 } 237 }
238 238
239 snprintf(vp_dev->msix_names[i + 1], 239 snprintf(vp_dev->msix_names[j],
240 sizeof(*vp_dev->msix_names), "%s-%s", 240 sizeof(*vp_dev->msix_names), "%s-%s",
241 dev_name(&vp_dev->vdev.dev), names[i]); 241 dev_name(&vp_dev->vdev.dev), names[i]);
242 err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec), 242 err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec),
243 vring_interrupt, IRQF_SHARED, 243 vring_interrupt, IRQF_SHARED,
244 vp_dev->msix_names[i + 1], vqs[i]); 244 vp_dev->msix_names[j], vqs[i]);
245 if (err) { 245 if (err) {
246 /* don't free this irq on error */ 246 /* don't free this irq on error */
247 vp_dev->msix_vector_map[i] = VIRTIO_MSI_NO_VECTOR; 247 vp_dev->msix_vector_map[i] = VIRTIO_MSI_NO_VECTOR;
248 goto out_remove_vqs; 248 goto out_remove_vqs;
249 } 249 }
250 vp_dev->msix_vector_map[i] = msix_vec; 250 vp_dev->msix_vector_map[i] = msix_vec;
251 j++;
251 252
252 /* 253 /*
253 * Use a different vector for each queue if they are available, 254 * Use a different vector for each queue if they are available,