Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c37406e0 authored by Christian König's avatar Christian König Committed by Bjorn Helgaas
Browse files

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: 8bb705e3 ("PCI: Add pci_resize_resource() for resizing BARs")
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
CC: stable@vger.kernel.org	# v4.15+
parent 6d516d67
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;