[PATCH v3 08/13] PCI: apple: Fix missing OF node reference in apple_pcie_setup_port

Marc Zyngier maz at kernel.org
Tue Apr 1 02:17:08 PDT 2025


From: Hector Martin <marcan at marcan.st>

In the success path, we hang onto a reference to the node, so make sure
to grab one. The caller iterator puts our borrowed reference when we
return.

Reviewed-by: Rob Herring (Arm) <robh at kernel.org>
Acked-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Tested-by: Janne Grunau <j at jannau.net>
Signed-off-by: Hector Martin <marcan at marcan.st>
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
 drivers/pci/controller/pcie-apple.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index 6b04bf0b41dcc..23d9f62bd2ad4 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -593,6 +593,9 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
 	list_add_tail(&port->entry, &pcie->ports);
 	init_completion(&pcie->event);
 
+	/* In the success path, we keep a reference to np around */
+	of_node_get(np);
+
 	ret = apple_pcie_port_register_irqs(port);
 	WARN_ON(ret);
 
-- 
2.39.2




More information about the linux-arm-kernel mailing list