Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Liang He <windhl@126.com>,
	khilman@baylibre.com, jbrunet@baylibre.com,
	martin.blumenstingl@googlemail.com, p.zabel@pengutronix.de,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org
Subject: Re: [PATCH v2] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
Date: Mon, 8 Aug 2022 10:07:20 +0200	[thread overview]
Message-ID: <5a2d281d-92c1-97e3-69a5-22a5d2942b52@baylibre.com> (raw)
In-Reply-To: <20220726073841.1320509-1-windhl@126.com>

On 26/07/2022 09:38, Liang He wrote:
> We should hold the reference returned by of_get_parent() and use
> it to call of_node_put() for refcount balance.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
>   drivers/soc/amlogic/meson-ee-pwrc.c     | 5 ++++-
>   drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 5 ++++-
>   2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c
> index 2be3afe6c2e3..dd5f2a13ceb5 100644
> --- a/drivers/soc/amlogic/meson-ee-pwrc.c
> +++ b/drivers/soc/amlogic/meson-ee-pwrc.c
> @@ -469,6 +469,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>   {
>   	const struct meson_ee_pwrc_domain_data *match;
>   	struct regmap *regmap_ao, *regmap_hhi;
> +	struct device_node *parent_np;
>   	struct meson_ee_pwrc *pwrc;
>   	int i, ret;
>   
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>   
>   	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)) {
>   		dev_err(&pdev->dev, "failed to get HHI regmap\n");
>   		return PTR_ERR(regmap_hhi);
> diff --git a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> index b4615b288625..312fd9afccb0 100644
> --- a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> +++ b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> @@ -273,6 +273,7 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
>   	const struct meson_gx_pwrc_vpu *vpu_pd_match;
>   	struct regmap *regmap_ao, *regmap_hhi;
>   	struct meson_gx_pwrc_vpu *vpu_pd;
> +	struct device_node *parent_np;
>   	struct reset_control *rstc;
>   	struct clk *vpu_clk;
>   	struct clk *vapb_clk;
> @@ -291,7 +292,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
>   
>   	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)) {
>   		dev_err(&pdev->dev, "failed to get regmap\n");
>   		return PTR_ERR(regmap_ao);

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  parent reply	other threads:[~2022-08-08  8:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  7:38 [PATCH v2] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent() Liang He
2022-07-26 21:12 ` Martin Blumenstingl
2022-08-08  8:07 ` Neil Armstrong [this message]
2022-08-12  8:23 ` Jerome Brunet
2022-09-05  7:24 ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a2d281d-92c1-97e3-69a5-22a5d2942b52@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=windhl@126.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox