aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/iov.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 4b3a4eaad996..c4c33ead03bc 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -180,6 +180,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
180 struct pci_dev *pdev; 180 struct pci_dev *pdev;
181 struct pci_sriov *iov = dev->sriov; 181 struct pci_sriov *iov = dev->sriov;
182 int bars = 0; 182 int bars = 0;
183 u8 bus;
183 184
184 if (!nr_virtfn) 185 if (!nr_virtfn)
185 return 0; 186 return 0;
@@ -216,8 +217,10 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
216 iov->offset = offset; 217 iov->offset = offset;
217 iov->stride = stride; 218 iov->stride = stride;
218 219
219 if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) { 220 bus = virtfn_bus(dev, nr_virtfn - 1);
220 dev_err(&dev->dev, "SR-IOV: bus number out of range\n"); 221 if (bus > dev->bus->busn_res.end) {
222 dev_err(&dev->dev, "can't enable %d VFs (bus %02x out of range of %pR)\n",
223 nr_virtfn, bus, &dev->bus->busn_res);
221 return -ENOMEM; 224 return -ENOMEM;
222 } 225 }
223 226