Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: HiSilicon: Fix device node reference leak in hi3670_pcie_get_resources_from_pcie()
@ 2026-09-17 13:41 Wentao Liang
  2026-10-12 16:09 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17 13:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-phy, mani, mchehab+huawei, neil.armstrong, vkoul,
	Wentao Liang, stable

hi3670_pcie_get_resources_from_pcie() obtains the "pcie" child node
with of_get_child_by_name(), which takes a reference on the node, but
never releases it: both the "Didn't find pcie device" and the "Failed
to get APB regmap" error paths, as well as the success path, return
without calling of_node_put().

The node is only needed for the device lookup, so drop the reference
right after bus_find_device_by_of_node().

Fixes: 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/phy/hisilicon/phy-hi3670-pcie.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
index 87eac058a4bc..35e634279794 100644
--- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
+++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
@@ -570,6 +570,7 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy)
 	}
 
 	pcie_dev = bus_find_device_by_of_node(&platform_bus_type, pcie_port);
+	of_node_put(pcie_port);
 	if (!pcie_dev) {
 		dev_err(dev, "Didn't find pcie device\n");
 		return -ENODEV;
-- 
2.34.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

end of thread, other threads:[~2026-10-12 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 13:41 [PATCH] phy: HiSilicon: Fix device node reference leak in hi3670_pcie_get_resources_from_pcie() Wentao Liang
2026-10-12 16:09 ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox