Re: [PATCH 1/1] PCI: Do not claim to release resource falsely
From: Bjorn Helgaas
Date: Fri Mar 07 2025 - 11:57:59 EST
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@xxxxxxxxxxxxxxx>
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
>