Skip to contentSkip to conversation

iov: add return failure condition for pci_setup_device

PATCH New Po Liu 2 participants 2 messages Aug 29, 2016 – Sep 12, 2016 PCI

lore
Share & tools
lore

Po Liu

author
#0 lore raw

PATCH 1/1 iov: add return failure condition for pci_setup_device

If pci_setup_device() return failure, return failure directly in the pci_iov_add_virtfn().

---
 drivers/pci/iov.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/iov.c +4 -1
index 2194b44..e30f05c 100644
@@ -136,7 +136,10 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)
 	virtfn->devfn = pci_iov_virtfn_devfn(dev, id);
 	virtfn->vendor = dev->vendor;
 	pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
-	pci_setup_device(virtfn);
+	rc = pci_setup_device(virtfn);
+	if (rc)
+		goto failed0;
+
 	virtfn->dev.parent = dev->dev.parent;
 	virtfn->physfn = pci_dev_get(dev);
 	virtfn->is_virtfn = 1;
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH 1/1 iov: add return failure condition for pci_setup_device

Quoted 4 lines · Po Liu

If pci_setup_device() return failure, return failure directly in the pci_iov_add_virtfn().

Applied to pci/virtualization for v4.9, thanks!

Quoted 28 lines
---
 drivers/pci/iov.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/iov.c +4 -1
index 2194b44..e30f05c 100644
@@ -136,7 +136,10 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)
 	virtfn->devfn = pci_iov_virtfn_devfn(dev, id);
 	virtfn->vendor = dev->vendor;
 	pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
-	pci_setup_device(virtfn);
+	rc = pci_setup_device(virtfn);
+	if (rc)
+		goto failed0;
+
 	virtfn->dev.parent = dev->dev.parent;
 	virtfn->physfn = pci_dev_get(dev);
 	virtfn->is_virtfn = 1;
Signature · 7 lines
2.1.0.27.g96db324


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel