PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
PATCH v2 1/1 PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
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.
---
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(-)
drivers/pci/controller/pcie-iproc.c +3 -7
@@ -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
Signature · 1 line
2.39.5
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
Declare
msi_nodewith__free(device_node)and drop theout_put_nodelabel 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 <[email protected]>Reviewed-by Marek Vasut <[email protected]>Signed-off-by Fuad Tabba <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Hi,
Gentle ping on this one.
Cheers,
/fuad
Quoted 27 lines · Fuad Tabba
Declare
msi_nodewith__free(device_node)and drop theout_put_nodelabel 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 <[email protected]>Reviewed-by Marek Vasut <[email protected]>Signed-off-by Fuad Tabba <[email protected]>---
Notes:
Changes since v1:
- Declaremsi_nodeimmediately beforeof_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(-)drivers/pci/controller/pcie-iproc.c +0
-0@@ -1338,13 +1338,13 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,
drivers/pci/controller/pcie-iproc.c static int iproc_pcie_msi_steer(struct iproc_pcie *pcie, · line 1347
Quoted 10 lines
drivers/pci/controller/pcie-iproc.c +1
-1static 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
Quoted 41 lines · Manivannan Sadhasivam
Quoted 27 lines · Fuad Tabba
Declare
msi_nodewith__free(device_node)and drop theout_put_nodelabel 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 <[email protected]>Reviewed-by Marek Vasut <[email protected]>Signed-off-by Fuad Tabba <[email protected]>---
Notes:
Changes since v1:
- Declaremsi_nodeimmediately beforeof_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(-)drivers/pci/controller/pcie-iproc.c +0
-0@@ -1338,13 +1338,13 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie,drivers/pci/controller/pcie-iproc.c static int iproc_pcie_msi_steer(struct iproc_pcie *pcie, · line 1347
Quoted 10 lines
drivers/pci/controller/pcie-iproc.c +1
-1static 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:
Quoted 6 lines
"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
Quoted 1 line · Fuad Tabba
PCI: iproc: Use
__free(device_node)iniproc_pcie_msi_enable()
Applied, thanks!
[1/1] PCI: iproc: Use __free(device_node) in iproc_pcie_msi_enable()
commit: f27468551f99d80c1f08be5194e9e520beb23908
Best regards,
Signature · 1 line
மணிவண்ணன் சதாசிவம்