mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
PCI: Allow release of resources that were never assigned
It is entirely possible that the BIOS wasn't able to assign resources to a
device. In this case don't crash in pci_release_resource() when we try to
resize the resource.
Fixes: 8bb705e3e7
("PCI: Add pci_resize_resource() for resizing BARs")
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
CC: stable@vger.kernel.org # v4.15+
This commit is contained in:
parent
6d516d6798
commit
c37406e05d
@ -401,6 +401,10 @@ void pci_release_resource(struct pci_dev *dev, int resno)
|
||||
struct resource *res = dev->resource + resno;
|
||||
|
||||
pci_info(dev, "BAR %d: releasing %pR\n", resno, res);
|
||||
|
||||
if (!res->parent)
|
||||
return;
|
||||
|
||||
release_resource(res);
|
||||
res->end = resource_size(res) - 1;
|
||||
res->start = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user