aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/pci_endpoint_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/pci_endpoint_test.c')
-rw-r--r--drivers/misc/pci_endpoint_test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 320276f42653..fe8897e64635 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -534,12 +534,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
534 } 534 }
535 535
536 for (bar = BAR_0; bar <= BAR_5; bar++) { 536 for (bar = BAR_0; bar <= BAR_5; bar++) {
537 base = pci_ioremap_bar(pdev, bar); 537 if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
538 if (!base) { 538 base = pci_ioremap_bar(pdev, bar);
539 dev_err(dev, "failed to read BAR%d\n", bar); 539 if (!base) {
540 WARN_ON(bar == test_reg_bar); 540 dev_err(dev, "failed to read BAR%d\n", bar);
541 WARN_ON(bar == test_reg_bar);
542 }
543 test->bar[bar] = base;
541 } 544 }
542 test->bar[bar] = base;
543 } 545 }
544 546
545 test->base = test->bar[test_reg_bar]; 547 test->base = test->bar[test_reg_bar];