All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] PCI: brcmstb: Fix refcount leak in brcm_pcie_probe
@ 2022-06-03 13:08 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-06-03 13:08 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Broadcom internal kernel review list,
	Jim Quinlan, Florian Fainelli, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Marc Zyngier,
	Andrew Murray, linux-rpi-kernel, linux-arm-kernel, linux-pci,
	linux-kernel
  Cc: linmq006

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: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- update Fixes tag.
v1 Link: https://lore.kernel.org/r/20220602125003.10723-1-linmq006@gmail.com
---
 drivers/pci/controller/pcie-brcmstb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 375c0c40bbf8..e3b673441a11 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1597,8 +1597,10 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 		ret = brcm_pcie_enable_msi(pcie);
 		if (ret) {
 			dev_err(pcie->dev, "probe of internal MSI failed");
+			of_node_put(msi_np);
 			goto fail;
 		}
+		of_node_put(msi_np);
 	}
 
 	bridge->ops = pcie->type == BCM7425 ? &brcm_pcie_ops32 : &brcm_pcie_ops;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-08 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 13:08 [PATCH v2] PCI: brcmstb: Fix refcount leak in brcm_pcie_probe Miaoqian Lin
2022-06-03 13:08 ` Miaoqian Lin
2022-06-06 21:33 ` Rob Herring
2022-06-06 21:33   ` Rob Herring
2022-06-08 20:25 ` Bjorn Helgaas
2022-06-08 20:25   ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.