Skip to content

Commit

Permalink
phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned…
Browse files Browse the repository at this point in the history
… by of_get_parent()

[ Upstream commit c4c349b ]

As the of_get_parent() will increase the refcount of the node->parent
and the reference will be discarded, so we should hold the reference
with which we can decrease the refcount when done.

Fixes: 8eff8b4 ("phy: amlogic: phy-meson-axg-mipi-pcie-analog: add support for MIPI DSI analog")
Signed-off-by: Liang He <windhl@126.com>

Link: https://lore.kernel.org/r/20220915093506.4009456-1-windhl@126.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
windhl authored and gregkh committed Oct 21, 2022
1 parent d7867e2 commit a43d6f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev)
struct phy_provider *phy;
struct device *dev = &pdev->dev;
struct phy_axg_mipi_pcie_analog_priv *priv;
struct device_node *np = dev->of_node;
struct device_node *np = dev->of_node, *parent_np;
struct regmap *map;
int ret;

Expand All @@ -206,7 +206,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev)
return -ENOMEM;

/* Get the hhi system controller node */
map = syscon_node_to_regmap(of_get_parent(dev->of_node));
parent_np = of_get_parent(dev->of_node);
map = syscon_node_to_regmap(parent_np);
of_node_put(parent_np);
if (IS_ERR(map)) {
dev_err(dev,
"failed to get HHI regmap\n");
Expand Down

0 comments on commit a43d6f5

Please sign in to comment.