PNP: Don't check for overlaps with unassigned PCI BARs
[firefly-linux-kernel-4.4.55.git] / drivers / pnp / quirks.c
index ebf0d6710b5a0d4150627313a3edca99e50a8745..943c1cb9566c803b168aac842aa00187a4627720 100644 (file)
@@ -246,13 +246,16 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
         */
        for_each_pci_dev(pdev) {
                for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
-                       unsigned long type;
+                       unsigned long flags, type;
 
-                       type = pci_resource_flags(pdev, i) &
-                                       (IORESOURCE_IO | IORESOURCE_MEM);
+                       flags = pci_resource_flags(pdev, i);
+                       type = flags & (IORESOURCE_IO | IORESOURCE_MEM);
                        if (!type || pci_resource_len(pdev, i) == 0)
                                continue;
 
+                       if (flags & IORESOURCE_UNSET)
+                               continue;
+
                        pci_start = pci_resource_start(pdev, i);
                        pci_end = pci_resource_end(pdev, i);
                        for (j = 0;