diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-05-10 15:14:28 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-06-09 22:28:28 +0200 |
commit | edb50a5403d2e2d2b2b63a8365c4378c9c300ed6 (patch) | |
tree | b35cad3dc3b2dc6d5fb41cc99fe3bd180ab8e4e6 | |
parent | Merge branch 'stable/for-jens-4.7' of git://git.kernel.org/pub/scm/linux/kern... (diff) | |
download | linux-edb50a5403d2e2d2b2b63a8365c4378c9c300ed6.tar.xz linux-edb50a5403d2e2d2b2b63a8365c4378c9c300ed6.zip |
NVMe: Only release requested regions
The NVMe driver only requests the PCIe device's memory regions but releases
all possible regions (including eventual I/O regions). This leads to a stale
warning entry in dmesg about freeing non existent resources.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/host/pci.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 78dca3193ca4..befac5b19490 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1679,9 +1679,14 @@ static int nvme_pci_enable(struct nvme_dev *dev) static void nvme_dev_unmap(struct nvme_dev *dev) { + struct pci_dev *pdev = to_pci_dev(dev->dev); + int bars; + if (dev->bar) iounmap(dev->bar); - pci_release_regions(to_pci_dev(dev->dev)); + + bars = pci_select_bars(pdev, IORESOURCE_MEM); + pci_release_selected_regions(pdev, bars); } static void nvme_pci_disable(struct nvme_dev *dev) @@ -1924,7 +1929,7 @@ static int nvme_dev_map(struct nvme_dev *dev) return 0; release: - pci_release_regions(pdev); + pci_release_selected_regions(pdev, bars); return -ENODEV; } |