Skip to contentSkip to conversation

PCI: Do not claim to release resource falsely

PATCH Applied Ilpo Järvinen 2 participants 2 messages Mar 7, 2025 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Do not claim to release resource falsely

pci_release_resource() will print "... releasing" regardless of the resource being assigned or not. Move the print after the res->parent check to avoid claiming the kernel would be releasing an unassigned resource.

Likely, none of the current callers pass a resource that is unassigned so this change is mostly to correct the non-sensical order than to remove errorneous printouts.

---
 drivers/pci/setup-res.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/setup-res.c +2 -2
index ca14576bf2bf..21719ae29a34 100644
@@ -414,11 +414,11 @@ void pci_release_resource(struct pci_dev *dev, int resno)
 	struct resource *res = dev->resource + resno;
 	const char *res_name = pci_resource_name(dev, resno);
 
-	pci_info(dev, "%s %pR: releasing\n", res_name, res);
-
 	if (!res->parent)
 		return;
 
+	pci_info(dev, "%s %pR: releasing\n", res_name, res);
+
 	release_resource(res);
 	res->end = resource_size(res) - 1;
 	res->start = 0;

base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
prerequisite-patch-id: e4a2c15d0cd3241e2fdb1af98510211e63ec3d06

Signature · 1 line
2.39.5
#1 lore raw
Quoted 10 lines · Ilpo Järvinen

pci_release_resource() will print "... releasing" regardless of the resource being assigned or not. Move the print after the res->parent check to avoid claiming the kernel would be releasing an unassigned resource.

Likely, none of the current callers pass a resource that is unassigned so this change is mostly to correct the non-sensical order than to remove errorneous printouts.

Applied to pci/resource for v6.15, thanks!

Quoted 28 lines
---
 drivers/pci/setup-res.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/setup-res.c +2 -2
index ca14576bf2bf..21719ae29a34 100644
@@ -414,11 +414,11 @@ void pci_release_resource(struct pci_dev *dev, int resno)
 	struct resource *res = dev->resource + resno;
 	const char *res_name = pci_resource_name(dev, resno);
 
-	pci_info(dev, "%s %pR: releasing\n", res_name, res);
-
 	if (!res->parent)
 		return;
 
+	pci_info(dev, "%s %pR: releasing\n", res_name, res);
+
 	release_resource(res);
 	res->end = resource_size(res) - 1;
 	res->start = 0;

base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
prerequisite-patch-id: e4a2c15d0cd3241e2fdb1af98510211e63ec3d06

Signature · 1 line
2.39.5