aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2015-03-12 13:30:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2015-03-12 19:52:22 -0400
commit1f7bf3bfb5d60c87dcaa708fd9eabbec93f15830 (patch)
tree4d958ba0627b2984e63d3885a4e00048260d476d /drivers/pci/pci.c
parentc770cb4cb505c096eaca0fbbca3169c3aa4c3474 (diff)
PCI: Show driver, BAR#, and resource on pci_ioremap_bar() failure
Use dev_warn() to complain about a pci_ioremap_bar() failure so we can include the driver name, BAR number, and the resource itself. We could use dev_WARN() to also get the backtrace as we did previously, but I think that's more information than we need. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 81f06e8dcc04..a6d191ad9743 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -126,15 +126,16 @@ EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
126#ifdef CONFIG_HAS_IOMEM 126#ifdef CONFIG_HAS_IOMEM
127void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) 127void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
128{ 128{
129 struct resource *res = &pdev->resource[bar];
130
129 /* 131 /*
130 * Make sure the BAR is actually a memory resource, not an IO resource 132 * Make sure the BAR is actually a memory resource, not an IO resource
131 */ 133 */
132 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { 134 if (!(res->flags & IORESOURCE_MEM)) {
133 WARN_ON(1); 135 dev_warn(&pdev->dev, "can't ioremap BAR %d: %pR\n", bar, res);
134 return NULL; 136 return NULL;
135 } 137 }
136 return ioremap_nocache(pci_resource_start(pdev, bar), 138 return ioremap_nocache(res->start, resource_size(res));
137 pci_resource_len(pdev, bar));
138} 139}
139EXPORT_SYMBOL_GPL(pci_ioremap_bar); 140EXPORT_SYMBOL_GPL(pci_ioremap_bar);
140#endif 141#endif