PCI: Don't convert BAR address to resource if dma_addr_t is too small
authorBjorn Helgaas <bhelgaas@google.com>
Wed, 30 Apr 2014 00:42:49 +0000 (18:42 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 23 May 2014 16:47:20 +0000 (10:47 -0600)
If dma_addr_t is too small to represent the BAR value,
pcibios_bus_to_resource() will fail, so just remember the BAR size directly
in the resource.  The resource is already marked UNSET, so we know the
address isn't valid anyway.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c

index afae3bf405fa53ff49a04d30925850392c091545..82cd75f6118a2f8e43c32e95bf802dd9bf064d11 100644 (file)
@@ -258,9 +258,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
                        pci_write_config_dword(dev, pos, 0);
                        pci_write_config_dword(dev, pos + 4, 0);
                        res->flags |= IORESOURCE_UNSET;
-                       region.start = 0;
-                       region.end = sz64;
+                       res->start = 0;
+                       res->end = sz64;
                        bar_disabled = true;
+                       goto out;
                } else {
                        region.start = l64;
                        region.end = l64 + sz64;