diff mbox series

powerpc: sysdev: fsl_msi: Add missing of_node_put() for of_parse_phandle()

Message ID 20220704145233.278539-1-windhl@126.com (mailing list archive)
State Accepted
Headers show
Series powerpc: sysdev: fsl_msi: Add missing of_node_put() for of_parse_phandle() | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu fail kernel (corenet64_smp_defconfig, korg-5.5.0, /linux/arch/powerpc/configs/ppc64e-qemu.config) failed at step build.
snowpatch_ozlabs/github-powerpc_sparse fail sparse (mpc885_ads_defconfig, ubuntu-21.10, ppc64) failed at step Build.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 7 jobs.

Commit Message

Liang He July 4, 2022, 2:52 p.m. UTC
In fsl_setup_msi_irqs(), we should use of_node_put() for the
refernece 'np' returned by of_parse_phandle() which increases
the refcount.

Fixes: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes")
Co-authored-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Liang He <windhl@126.com>
---

 There is an incomplete fix: 
 https://lore.kernel.org/all/20220526010935.32138-1-zhengyongjun3@huawei.com/

 We should call of_node_put() both in fail path and normal path.

 arch/powerpc/sysdev/fsl_msi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Ellerman Sept. 9, 2022, 12:07 p.m. UTC | #1
On Mon, 4 Jul 2022 22:52:33 +0800, Liang He wrote:
> In fsl_setup_msi_irqs(), we should use of_node_put() for the
> refernece 'np' returned by of_parse_phandle() which increases
> the refcount.
> 
> 

Applied to powerpc/next.

[1/1] powerpc: sysdev: fsl_msi: Add missing of_node_put() for of_parse_phandle()
      https://git.kernel.org/powerpc/c/def435c04ee984a5f9ed2711b2bfe946936c6a21

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index ef9a5999fa93..73c2d70706c0 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -209,8 +209,10 @@  static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 			dev_err(&pdev->dev,
 				"node %pOF has an invalid fsl,msi phandle %u\n",
 				hose->dn, np->phandle);
+			of_node_put(np);
 			return -EINVAL;
 		}
+		of_node_put(np);
 	}
 
 	msi_for_each_desc(entry, &pdev->dev, MSI_DESC_NOTASSOCIATED) {