[PATCH v2 15/16] PCI: Keep the range of fixed resources when releasing them
From: Ilpo Järvinen
Date: Fri Dec 04 2026 - 19:43:35 EST
pci_resource_post_release() resets the start of a released resource to 0
and marks it IORESOURCE_UNSET. For an IORESOURCE_PCI_FIXED resource,
this discards the fixed range, whereas the rest of the resource fitting
and assignment code never changes the range of a fixed resource.
None of the callers of pci_release_resource() releases a fixed resource
in practice, but for consistency, return early from
pci_resource_post_release() for fixed resources to keep their range and
flags. The resource is already detached from the resource tree, so
pdev_assign_fixed_resources() can claim it again.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
---
drivers/pci/setup-res.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index a56e0cc3db58..82efd4a76c15 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -471,6 +471,10 @@ static void pci_resource_post_release(struct pci_dev *dev, int resno)
pci_info(dev, "%s %pR: released\n", res_name, res);
+ /* Keep the range so that the fixed resource can be claimed again */
+ if (res->flags & IORESOURCE_PCI_FIXED)
+ return;
+
res->end = resource_size(res) - 1;
res->start = 0;
res->flags |= IORESOURCE_UNSET;
--
2.47.3