From: sashiko-bot@kernel.org
To: "Tian Xuechen" <202300460064@mail.sdu.edu.cn>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH 1/2] pmdomain: amlogic: Tear down EE domains and their OF provider
Date: Fri, 27 Nov 2026 11:44:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-237266@kernel.org> (raw)
In-Reply-To: <20261127113326.390398-2-202300460064@mail.sdu.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] pmdomain: amlogic: clock prepare/enable leak in
meson_ee_pwrc_init_domain()
--
commit e98fddbd00e9a83bce5020c8ad856e22d6525ccc
Author: Tian Xuechen <202300460064@mail.sdu.edu.cn>
pmdomain: amlogic: Tear down EE domains and their OF provider
This commit removes the OF genpd provider on driver unbind and registers
a devm cleanup action to remove initialized power domains on probe
failure or unbind.
> diff --git a/drivers/pmdomain/amlogic/meson-ee-pwrc.c b/drivers/pmdomain/amlogic/meson-ee-pwrc.c
> index 338f70d77bf03..f108d9337e5e4 100644
> --- a/drivers/pmdomain/amlogic/meson-ee-pwrc.c
> +++ b/drivers/pmdomain/amlogic/meson-ee-pwrc.c
> @@ -428,6 +428,16 @@ static int meson_ee_pwrc_on(struct generic_pm_domain *domain)
> pwrc_domain->clks);
> }
>
> +static void meson_ee_pwrc_remove_domain(void *data)
> +{
> + pm_genpd_remove(data);
> +}
> +
> +static void meson_ee_pwrc_remove(struct platform_device *pdev)
> +{
> + of_genpd_del_provider(pdev->dev.of_node);
> +}
> +
> static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
> struct meson_ee_pwrc *pwrc,
> struct meson_ee_pwrc_domain *dom)
> @@ -494,7 +504,8 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
> return ret;
> }
>
> - return 0;
> + return devm_add_action_or_reset(&pdev->dev, meson_ee_pwrc_remove_domain,
> + &dom->base);
> }
[Severity: Medium]
Does this leak the prepare and enable references on dom->clks when an
already-powered-on domain is torn down or fails to initialize?
In meson_ee_pwrc_init_domain(), a domain with clocks that is already
powered on calls clk_bulk_prepare_enable() and sets GENPD_FLAG_ALWAYS_ON:
drivers/pmdomain/amlogic/meson-ee-pwrc.c:meson_ee_pwrc_init_domain() {
if (dom->num_clks && dom->desc.is_powered_off && !dom->desc.is_powered_off(dom)) {
ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks);
if (ret)
return ret;
dom->base.flags = GENPD_FLAG_ALWAYS_ON;
ret = pm_genpd_init(&dom->base, NULL, false);
if (ret)
return ret;
}
}
Neither a failure in pm_genpd_init() nor meson_ee_pwrc_remove_domain()
calls clk_bulk_disable_unprepare(), and devm_clk_bulk_get_all() only puts
the clock handles on release, leaving their prepare and enable counts
elevated on probe failure or driver unbind.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127113326.390398-1-202300460064@mail.sdu.edu.cn?part=1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-11-27 11:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 11:33 [PATCH 0/2] pmdomain: amlogic: Add teardown for EE and secure power domains Tian Xuechen
2026-11-27 11:33 ` [PATCH 1/2] pmdomain: amlogic: Tear down EE domains and their OF provider Tian Xuechen
2026-11-27 11:44 ` sashiko-bot [this message]
2026-11-27 11:33 ` [PATCH 2/2] pmdomain: amlogic: Tear down secure " Tian Xuechen
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=sashiko-outbox-237266@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=202300460064@mail.sdu.edu.cn \
--cc=linux-amlogic@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
/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