[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f848ff97-9118-3e4a-d07c-c5009a4c310c@linux.intel.com>
Date: Mon, 25 Aug 2025 13:13:06 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Markus Elfring <Markus.Elfring@....de>
cc: linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PCI: Reduce the scope for a variable in
pci_bridge_release_resources()
On Sat, 23 Aug 2025, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sat, 23 Aug 2025 09:40:13 +0200
>
> * Move the definition for the local variable “old_flags”
> into an if branch.
> * Put the assignment for the local variable “type” on a separate line.
>
> The source code was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
> drivers/pci/setup-bus.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 119f97b96480..38bf4e673bd7 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -1714,7 +1714,6 @@ static void pci_bridge_release_resources(struct pci_bus *bus,
> {
> struct pci_dev *dev = bus->self;
> struct resource *r;
> - unsigned int old_flags;
> struct resource *b_res;
> int idx = 1;
>
> @@ -1751,7 +1750,9 @@ static void pci_bridge_release_resources(struct pci_bus *bus,
> /* If there are children, release them all */
> release_child_resources(r);
> if (!release_resource(r)) {
> - type = old_flags = r->flags & PCI_RES_TYPE_MASK;
> + unsigned int old_flags = r->flags & PCI_RES_TYPE_MASK;
> +
> + type = old_flags;
> pci_info(dev, "resource %d %pR released\n",
> PCI_BRIDGE_RESOURCES + idx, r);
> /* Keep the old size */
My series is going to remove these variable altogether. A) One shouldn't
be messing with type (flags) at all which this code the tried to work
around by carrying the type information over the code that cleared it, and
B) there's a gross hack in how type is being handled. Both are solved by
my series.
Although, now that you posted this patch, I ended up realizing there's a
transient problem in my series, the assignment to type got removed too
early (should only be removed along with the type related hack, will be
fixed by v2 of my series).
--
i.
Powered by blists - more mailing lists