]>
Commit | Line | Data |
---|---|---|
8f7de196 SL |
1 | From 2420fabbb4e09ca542f3c29793d06dc54d1014cd Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Thu, 15 Sep 2022 17:35:06 +0800 | |
4 | Subject: phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned | |
5 | by of_get_parent() | |
6 | ||
7 | From: Liang He <windhl@126.com> | |
8 | ||
9 | [ Upstream commit c4c349be07aeec5f397a349046dc5fc0f2657691 ] | |
10 | ||
11 | As the of_get_parent() will increase the refcount of the node->parent | |
12 | and the reference will be discarded, so we should hold the reference | |
13 | with which we can decrease the refcount when done. | |
14 | ||
15 | Fixes: 8eff8b4e22d9 ("phy: amlogic: phy-meson-axg-mipi-pcie-analog: add support for MIPI DSI analog") | |
16 | Signed-off-by: Liang He <windhl@126.com> | |
17 | ||
18 | Link: https://lore.kernel.org/r/20220915093506.4009456-1-windhl@126.com | |
19 | Signed-off-by: Vinod Koul <vkoul@kernel.org> | |
20 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
21 | --- | |
22 | drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 6 ++++-- | |
23 | 1 file changed, 4 insertions(+), 2 deletions(-) | |
24 | ||
25 | diff --git a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | |
26 | index 1027ece6ca12..a3e1108b736d 100644 | |
27 | --- a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | |
28 | +++ b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | |
29 | @@ -197,7 +197,7 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) | |
30 | struct phy_provider *phy; | |
31 | struct device *dev = &pdev->dev; | |
32 | struct phy_axg_mipi_pcie_analog_priv *priv; | |
33 | - struct device_node *np = dev->of_node; | |
34 | + struct device_node *np = dev->of_node, *parent_np; | |
35 | struct regmap *map; | |
36 | int ret; | |
37 | ||
38 | @@ -206,7 +206,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) | |
39 | return -ENOMEM; | |
40 | ||
41 | /* Get the hhi system controller node */ | |
42 | - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); | |
43 | + parent_np = of_get_parent(dev->of_node); | |
44 | + map = syscon_node_to_regmap(parent_np); | |
45 | + of_node_put(parent_np); | |
46 | if (IS_ERR(map)) { | |
47 | dev_err(dev, | |
48 | "failed to get HHI regmap\n"); | |
49 | -- | |
50 | 2.35.1 | |
51 |