* [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
@ 2026-09-23 18:07 Fuad Tabba
2026-10-07 3:23 ` Fuad Tabba
2026-10-18 4:11 ` Manivannan Sadhasivam
0 siblings, 2 replies; 4+ messages in thread
From: Fuad Tabba @ 2026-09-23 18:07 UTC (permalink / raw)
To: Manivannan Sadhasivam, Krzysztof Wilczyński,
Lorenzo Pieralisi, Bjorn Helgaas
Cc: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
Marek Vasut, Jonathan Cameron, linux-pci, linux-arm-kernel,
linux-kernel, Will Deacon, Fuad Tabba
Declare msi_node with __free(device_node) and drop the out_put_node
label and its goto: the scoped cleanup puts the MSI controller node on
every return, as the label did.
No functional change intended.
Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Link: https://lore.kernel.org/linux-pci/61488ddc-b346-4ba3-b32a-e972a3bd75a4@mailbox.org/
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
Notes:
Changes since v1:
- Declare msi_node immediately before of_msi_xlate() rather than at the
top of the function (Jonathan).
- Kept Marek's Reviewed-by, since the generated code is unchanged.
drivers/pci/controller/pcie-iproc.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
index afb3aa38ac6bb..bf455f2a9d9a9 100644
--- a/drivers/pci/controller/pcie-iproc.c
+++ b/drivers/pci/controller/pcie-iproc.c
@@ -1338,13 +1338,13 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,
static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
{
- struct device_node *msi_node = NULL;
int ret;
/*
* Either the "msi-parent" or the "msi-map" phandle needs to exist
* for us to obtain the MSI node.
*/
+ struct device_node *msi_node __free(device_node) = NULL;
of_msi_xlate(pcie->dev, &msi_node, 0);
if (!msi_node)
return -ENODEV;
@@ -1357,18 +1357,14 @@ static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
if (pcie->need_msi_steer) {
ret = iproc_pcie_msi_steer(pcie, msi_node);
if (ret)
- goto out_put_node;
+ return ret;
}
/*
* If another MSI controller is being used, the call below should fail
* but that is okay
*/
- ret = iproc_msi_init(pcie, msi_node);
-
-out_put_node:
- of_node_put(msi_node);
- return ret;
+ return iproc_msi_init(pcie, msi_node);
}
static void iproc_pcie_msi_disable(struct iproc_pcie *pcie)
base-commit: fd73f4a6659897191fa0d40695fe370925dd3780
--
2.39.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
2026-09-23 18:07 [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable() Fuad Tabba
@ 2026-10-07 3:23 ` Fuad Tabba
2026-10-18 4:11 ` Manivannan Sadhasivam
1 sibling, 0 replies; 4+ messages in thread
From: Fuad Tabba @ 2026-10-07 3:23 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Rob Herring, Ray Jui, Scott Branden, bcm-kernel-feedback-list,
Marek Vasut, Jonathan Cameron, linux-pci, linux-arm-kernel,
linux-kernel, Will Deacon, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas
Hi,
Gentle ping on this one.
Cheers,
/fuad
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
2026-09-23 18:07 [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable() Fuad Tabba
2026-10-07 3:23 ` Fuad Tabba
@ 2026-10-18 4:11 ` Manivannan Sadhasivam
2026-10-18 4:15 ` Manivannan Sadhasivam
1 sibling, 1 reply; 4+ messages in thread
From: Manivannan Sadhasivam @ 2026-10-18 4:11 UTC (permalink / raw)
To: Fuad Tabba
Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
Lorenzo Pieralisi, Bjorn Helgaas, Rob Herring, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Marek Vasut,
Jonathan Cameron, linux-pci, linux-arm-kernel, linux-kernel,
Will Deacon, Fuad Tabba
On 2026-09-23 19:07 +0100, Fuad Tabba wrote:
> Declare msi_node with __free(device_node) and drop the out_put_node
> label and its goto: the scoped cleanup puts the MSI controller node on
> every return, as the label did.
>
> No functional change intended.
>
> Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Link: https://lore.kernel.org/linux-pci/61488ddc-b346-4ba3-b32a-e972a3bd75a4@mailbox.org/
> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> ---
>
> Notes:
> Changes since v1:
> - Declare msi_node immediately before of_msi_xlate() rather than at the
> top of the function (Jonathan).
> - Kept Marek's Reviewed-by, since the generated code is unchanged.
>
> drivers/pci/controller/pcie-iproc.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index afb3aa38ac6bb..bf455f2a9d9a9 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1338,13 +1338,13 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,
>
> static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
> {
> - struct device_node *msi_node = NULL;
> int ret;
>
> /*
> * Either the "msi-parent" or the "msi-map" phandle needs to exist
> * for us to obtain the MSI node.
> */
> + struct device_node *msi_node __free(device_node) = NULL;
As per cleanup.h:
"Given that the "__free(...) = NULL" pattern for variables defined at
the top of the function poses this potential interdependency problem
the recommendation is to always define and assign variables in one
statement and not group variable definitions at the top of the
function when __free() is used."
- Mani
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
2026-10-18 4:11 ` Manivannan Sadhasivam
@ 2026-10-18 4:15 ` Manivannan Sadhasivam
0 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2026-10-18 4:15 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Fuad Tabba, Manivannan Sadhasivam, Krzysztof Wilczyński,
Lorenzo Pieralisi, Bjorn Helgaas, Rob Herring, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Marek Vasut,
Jonathan Cameron, linux-pci, linux-arm-kernel, linux-kernel,
Will Deacon, Fuad Tabba
On 2026-10-18 09:41 +0530, Manivannan Sadhasivam wrote:
> On 2026-09-23 19:07 +0100, Fuad Tabba wrote:
> > Declare msi_node with __free(device_node) and drop the out_put_node
> > label and its goto: the scoped cleanup puts the MSI controller node on
> > every return, as the label did.
> >
> > No functional change intended.
> >
> > Suggested-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> > Link: https://lore.kernel.org/linux-pci/61488ddc-b346-4ba3-b32a-e972a3bd75a4@mailbox.org/
> > Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> > Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> > ---
> >
> > Notes:
> > Changes since v1:
> > - Declare msi_node immediately before of_msi_xlate() rather than at the
> > top of the function (Jonathan).
> > - Kept Marek's Reviewed-by, since the generated code is unchanged.
> >
> > drivers/pci/controller/pcie-iproc.c | 10 +++-------
> > 1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> > index afb3aa38ac6bb..bf455f2a9d9a9 100644
> > --- a/drivers/pci/controller/pcie-iproc.c
> > +++ b/drivers/pci/controller/pcie-iproc.c
> > @@ -1338,13 +1338,13 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,
> >
> > static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
> > {
> > - struct device_node *msi_node = NULL;
> > int ret;
> >
> > /*
> > * Either the "msi-parent" or the "msi-map" phandle needs to exist
> > * for us to obtain the MSI node.
> > */
> > + struct device_node *msi_node __free(device_node) = NULL;
>
> As per cleanup.h:
>
> "Given that the "__free(...) = NULL" pattern for variables defined at
> the top of the function poses this potential interdependency problem
> the recommendation is to always define and assign variables in one
> statement and not group variable definitions at the top of the
> function when __free() is used."
>
Hmm. I replied too fast. I think in this case, it is OK since the variable is
passed as a reference in its first usage.
- Mani
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-18 4:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 18:07 [PATCH v2] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable() Fuad Tabba
2026-10-07 3:23 ` Fuad Tabba
2026-10-18 4:11 ` Manivannan Sadhasivam
2026-10-18 4:15 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®