* [PATCH -next] phy: hisilicon: Add resource release in hi3670_pcie_get_resources_from_pcie
@ 2022-04-26 11:05 ` Yuan Can
0 siblings, 0 replies; 2+ messages in thread
From: Yuan Can @ 2022-04-26 11:05 UTC (permalink / raw)
To: linux-phy
Cc: linux-kernel, kishon, vkoul, mchehab+huawei, dan.carpenter, mani,
yuancan
Reference count of pcie_port and pcie_dev should be decremented when
error occurs.
Fixes: 73075011ffff8 (phy: HiSilicon: Add driver for Kirin 970 PCIe PHY)
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
drivers/phy/hisilicon/phy-hi3670-pcie.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
index 0ac9634b398d..77c9c72d939e 100644
--- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
+++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
@@ -567,6 +567,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);
if (!pcie_dev) {
dev_err(dev, "Didn't find pcie device\n");
+ of_node_put(pcie_port);
return -ENODEV;
}
@@ -581,6 +582,8 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy)
phy->apb = dev_get_regmap(pcie_dev, "kirin_pcie_apb");
if (!phy->apb) {
dev_err(dev, "Failed to get APB regmap\n");
+ put_device(pcie_dev);
+ of_node_put(pcie_port);
return -ENODEV;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH -next] phy: hisilicon: Add resource release in hi3670_pcie_get_resources_from_pcie
@ 2022-04-26 11:05 ` Yuan Can
0 siblings, 0 replies; 2+ messages in thread
From: Yuan Can @ 2022-04-26 11:05 UTC (permalink / raw)
To: linux-phy
Cc: linux-kernel, kishon, vkoul, mchehab+huawei, dan.carpenter, mani,
yuancan
Reference count of pcie_port and pcie_dev should be decremented when
error occurs.
Fixes: 73075011ffff8 (phy: HiSilicon: Add driver for Kirin 970 PCIe PHY)
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
drivers/phy/hisilicon/phy-hi3670-pcie.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
index 0ac9634b398d..77c9c72d939e 100644
--- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
+++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
@@ -567,6 +567,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);
if (!pcie_dev) {
dev_err(dev, "Didn't find pcie device\n");
+ of_node_put(pcie_port);
return -ENODEV;
}
@@ -581,6 +582,8 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy)
phy->apb = dev_get_regmap(pcie_dev, "kirin_pcie_apb");
if (!phy->apb) {
dev_err(dev, "Failed to get APB regmap\n");
+ put_device(pcie_dev);
+ of_node_put(pcie_port);
return -ENODEV;
}
--
2.17.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:[~2022-04-26 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 11:05 [PATCH -next] phy: hisilicon: Add resource release in hi3670_pcie_get_resources_from_pcie Yuan Can
2022-04-26 11:05 ` Yuan Can
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.