[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220426110543.49726-1-yuancan@huawei.com>
Date: Tue, 26 Apr 2022 11:05:43 +0000
From: Yuan Can <yuancan@...wei.com>
To: <linux-phy@...ts.infradead.org>
CC: <linux-kernel@...r.kernel.org>, <kishon@...com>,
<vkoul@...nel.org>, <mchehab+huawei@...nel.org>,
<dan.carpenter@...cle.com>, <mani@...nel.org>, <yuancan@...wei.com>
Subject: [PATCH -next] phy: hisilicon: Add resource release in hi3670_pcie_get_resources_from_pcie
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@...wei.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
Powered by blists - more mailing lists