aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-11-14 11:50:19 -0500
committerJens Axboe <axboe@fb.com>2014-11-20 13:10:06 -0500
commitbe7837e89d610046ae8dd28dc504df09261d9f91 (patch)
tree6ea5c96d1004ce9f10248312d26d70a2ed7b494f
parent2c30540b38d683d4c7f06d13a451f67d4362d7b1 (diff)
NVMe: fail pci initialization if the device doesn't have any BARs
The PCI init of NVMe doesn't check for valid bars before proceeding to map and use BAR 0. If the device is hosed (or firmware is), then we should catch this case and give up early. This fixes a: [ 1662.035778] WARNING: CPU: 0 PID: 4 at arch/x86/mm/ioremap.c:63 __ioremap_check_ram+0xa7/0xc0() and later badness on such a device. Acked-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/block/nvme-core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index ba278ae00705..c1541652b7e0 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2156,6 +2156,9 @@ static int nvme_dev_map(struct nvme_dev *dev)
2156 dev->entry[0].vector = pdev->irq; 2156 dev->entry[0].vector = pdev->irq;
2157 pci_set_master(pdev); 2157 pci_set_master(pdev);
2158 bars = pci_select_bars(pdev, IORESOURCE_MEM); 2158 bars = pci_select_bars(pdev, IORESOURCE_MEM);
2159 if (!bars)
2160 goto disable_pci;
2161
2159 if (pci_request_selected_regions(pdev, bars, "nvme")) 2162 if (pci_request_selected_regions(pdev, bars, "nvme"))
2160 goto disable_pci; 2163 goto disable_pci;
2161 2164