From: sashiko-bot@kernel.org
To: "Guangshuo Li" <liguangshuo@mail.sdu.edu.cn>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: nuvoton: Manage MA35D1 mux clocks with the controller
Date: Thu, 26 Nov 2026 08:32:48 +0000 [thread overview]
Message-ID: <sashiko-outbox-235026@kernel.org> (raw)
In-Reply-To: <20261126-a35bb25eb5-u10-0@mail.sdu.edu.cn>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] clk: nuvoton: use-after-free in ma35d1_clocks_probe() [1]
--
commit 9ff45d0263efa96de1be9a7ff0a42ea74ccdf3fa
Author: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
clk: nuvoton: Manage MA35D1 mux clocks with the controller
This commit converts ma35d1_clk_mux_parent() and ma35d1_clk_mux() to use
devm_clk_hw_register_mux_parent_data_table() so that the mux clocks are
automatically unregistered when the platform device is removed.
> diff --git a/drivers/clk/nuvoton/clk-ma35d1.c b/drivers/clk/nuvoton/clk-ma35d1.c
> index e95f72bb81032..4428556b64ade 100644
> --- a/drivers/clk/nuvoton/clk-ma35d1.c
> +++ b/drivers/clk/nuvoton/clk-ma35d1.c
> @@ -380,9 +380,9 @@ static struct clk_hw *ma35d1_clk_mux_parent(struct device *dev, const char *name
> const struct clk_parent_data *pdata,
> int num_pdata)
> {
> - return clk_hw_register_mux_parent_data(dev, name, pdata, num_pdata,
> - CLK_SET_RATE_NO_REPARENT, reg, shift,
> - width, 0, &ma35d1_lock);
> + return devm_clk_hw_register_mux_parent_data_table(dev, name, pdata, num_pdata,
> + CLK_SET_RATE_NO_REPARENT, reg, shift,
> + width, 0, NULL, &ma35d1_lock);
> }
>
> static struct clk_hw *ma35d1_clk_mux(struct device *dev, const char *name,
> @@ -390,9 +390,9 @@ static struct clk_hw *ma35d1_clk_mux(struct device *dev, const char *name,
> const struct clk_parent_data *pdata,
> int num_pdata)
> {
> - return clk_hw_register_mux_parent_data(dev, name, pdata, num_pdata,
> - CLK_SET_RATE_NO_REPARENT, reg, shift,
> - width, 0, &ma35d1_lock);
> + return devm_clk_hw_register_mux_parent_data_table(dev, name, pdata, num_pdata,
> + CLK_SET_RATE_NO_REPARENT, reg, shift,
> + width, 0, NULL, &ma35d1_lock);
> }
[Severity: Critical]
This problem wasn't introduced by this patch, but right above
ma35d1_clk_mux_parent(), doesn't ma35d1_clk_fixed() also leave its clocks
registered on probe failure or driver unbind [1]?
drivers/clk/nuvoton/clk-ma35d1.c:ma35d1_clk_fixed() {
return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
}
Because ma35d1_clk_fixed() uses the unmanaged
clk_hw_register_fixed_rate() helper instead of
devm_clk_hw_register_fixed_rate(), the fixed-rate clocks remain
registered in the clock framework and leak after ma35d1_clocks_probe()
fails or the device is unbound.
[1] https://sashiko.dev/#/bug/linux-0fffc72d-3bbf-4403-b81b-eac9ff603015
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-a35bb25eb5-u10-0@mail.sdu.edu.cn?part=1
prev parent reply other threads:[~2026-11-26 8:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 8:26 [PATCH] clk: nuvoton: Manage MA35D1 mux clocks with the controller Guangshuo Li
2026-11-26 8:32 ` sashiko-bot [this message]
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-235026@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=liguangshuo@mail.sdu.edu.cn \
--cc=linux-clk@vger.kernel.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