Merge tag 'pci-v5.3-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
[sfrench/cifs-2.6.git] / drivers / pci / pci-driver.c
index 36dbe960306b76a418e2b3c5dfbeee14b3e38777..a8124e47bf6e3a5c4c5cb46ba15a7b76ac0204db 100644 (file)
@@ -399,7 +399,8 @@ void __weak pcibios_free_irq(struct pci_dev *dev)
 #ifdef CONFIG_PCI_IOV
 static inline bool pci_device_can_probe(struct pci_dev *pdev)
 {
-       return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe);
+       return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe ||
+               pdev->driver_override);
 }
 #else
 static inline bool pci_device_can_probe(struct pci_dev *pdev)
@@ -414,6 +415,9 @@ static int pci_device_probe(struct device *dev)
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct pci_driver *drv = to_pci_driver(dev->driver);
 
+       if (!pci_device_can_probe(pci_dev))
+               return -ENODEV;
+
        pci_assign_irq(pci_dev);
 
        error = pcibios_alloc_irq(pci_dev);
@@ -421,12 +425,10 @@ static int pci_device_probe(struct device *dev)
                return error;
 
        pci_dev_get(pci_dev);
-       if (pci_device_can_probe(pci_dev)) {
-               error = __pci_device_probe(drv, pci_dev);
-               if (error) {
-                       pcibios_free_irq(pci_dev);
-                       pci_dev_put(pci_dev);
-               }
+       error = __pci_device_probe(drv, pci_dev);
+       if (error) {
+               pcibios_free_irq(pci_dev);
+               pci_dev_put(pci_dev);
        }
 
        return error;