Commit 9491cff1 authored by Liang He's avatar Liang He Committed by Neil Armstrong

soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()

We should hold the reference returned by of_get_parent() and use
it to call of_node_put() for refcount balance.
Signed-off-by: default avatarLiang He <windhl@126.com>
Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20220726073841.1320509-1-windhl@126.com
parent 568035b0
...@@ -469,6 +469,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev) ...@@ -469,6 +469,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
{ {
const struct meson_ee_pwrc_domain_data *match; const struct meson_ee_pwrc_domain_data *match;
struct regmap *regmap_ao, *regmap_hhi; struct regmap *regmap_ao, *regmap_hhi;
struct device_node *parent_np;
struct meson_ee_pwrc *pwrc; struct meson_ee_pwrc *pwrc;
int i, ret; int i, ret;
...@@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev) ...@@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
pwrc->xlate.num_domains = match->count; pwrc->xlate.num_domains = match->count;
regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node)); parent_np = of_get_parent(pdev->dev.of_node);
regmap_hhi = syscon_node_to_regmap(parent_np);
of_node_put(parent_np);
if (IS_ERR(regmap_hhi)) { if (IS_ERR(regmap_hhi)) {
dev_err(&pdev->dev, "failed to get HHI regmap\n"); dev_err(&pdev->dev, "failed to get HHI regmap\n");
return PTR_ERR(regmap_hhi); return PTR_ERR(regmap_hhi);
......
...@@ -273,6 +273,7 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev) ...@@ -273,6 +273,7 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
const struct meson_gx_pwrc_vpu *vpu_pd_match; const struct meson_gx_pwrc_vpu *vpu_pd_match;
struct regmap *regmap_ao, *regmap_hhi; struct regmap *regmap_ao, *regmap_hhi;
struct meson_gx_pwrc_vpu *vpu_pd; struct meson_gx_pwrc_vpu *vpu_pd;
struct device_node *parent_np;
struct reset_control *rstc; struct reset_control *rstc;
struct clk *vpu_clk; struct clk *vpu_clk;
struct clk *vapb_clk; struct clk *vapb_clk;
...@@ -291,7 +292,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev) ...@@ -291,7 +292,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
memcpy(vpu_pd, vpu_pd_match, sizeof(*vpu_pd)); memcpy(vpu_pd, vpu_pd_match, sizeof(*vpu_pd));
regmap_ao = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node)); parent_np = of_get_parent(pdev->dev.of_node);
regmap_ao = syscon_node_to_regmap(parent_np);
of_node_put(parent_np);
if (IS_ERR(regmap_ao)) { if (IS_ERR(regmap_ao)) {
dev_err(&pdev->dev, "failed to get regmap\n"); dev_err(&pdev->dev, "failed to get regmap\n");
return PTR_ERR(regmap_ao); return PTR_ERR(regmap_ao);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment