* [PATCH] phy: HiSilicon: Fix PCIe device reference leak in hi3670_pcie_get_resources_from_pcie()
@ 2026-09-17 13:39 Wentao Liang
0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-09-17 13:39 UTC (permalink / raw)
To: linux-kernel
Cc: linux-phy, mani, mchehab+huawei, neil.armstrong, vkoul,
Wentao Liang, stable
hi3670_pcie_get_resources_from_pcie() gets a reference to the PCIe
platform device with bus_find_device_by_of_node(), but never releases
it. The reference is not stored anywhere, so it is leaked both when
dev_get_regmap() fails and on the success path.
Drop the reference right after the regmap lookup, the last use of the
device.
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 dbc7dcce682b..87eac058a4bc 100644
--- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
+++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
@@ -584,6 +584,7 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy)
* right regmap. So, let's use the named version.
*/
phy->apb = dev_get_regmap(pcie_dev, "kirin_pcie_apb");
+ put_device(pcie_dev);
if (!phy->apb) {
dev_err(dev, "Failed to get APB regmap\n");
return -ENODEV;
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-17 13:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 13:39 [PATCH] phy: HiSilicon: Fix PCIe device reference leak in hi3670_pcie_get_resources_from_pcie() Wentao Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®