2022-05-26 10:26:58

by Zheng Yongjun

[permalink] [raw]
Subject: [PATCH] powerpc: Fix refcount leak in fsl_setup_msi_irqs

of_parse_phandle() returns a node pointer with refcount incremented,
we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes")
Signed-off-by: Zheng Yongjun <[email protected]>
---
arch/powerpc/sysdev/fsl_msi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index b3475ae9f236..dcc6c8997b09 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -207,6 +207,7 @@ 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;
}
}
--
2.17.1