diff mbox series

[1/1] PCI: Do not claim to release resource falsely

Message ID 20250307140922.5776-1-ilpo.jarvinen@linux.intel.com (mailing list archive)
State Accepted
Headers show
Series [1/1] PCI: Do not claim to release resource falsely | expand

Commit Message

Ilpo Järvinen March 7, 2025, 2:09 p.m. UTC
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.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/setup-res.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


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

Comments

Bjorn Helgaas March 7, 2025, 4:57 p.m. UTC | #1
On Fri, Mar 07, 2025 at 04:09:22PM +0200, Ilpo Järvinen wrote:
> 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.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

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

> ---
>  drivers/pci/setup-res.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
> index ca14576bf2bf..21719ae29a34 100644
> --- a/drivers/pci/setup-res.c
> +++ b/drivers/pci/setup-res.c
> @@ -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
> -- 
> 2.39.5
>
diff mbox series

Patch

diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index ca14576bf2bf..21719ae29a34 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -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;