From: Adrian Hunter <adrian.hunter@intel.com>
To: Wentao Liang <vulab@iscas.ac.cn>,
Michal Simek <michal.simek@amd.com>,
"Ulf Hansson" <ulfh@kernel.org>, <swati.agarwal@amd.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH] mmc: sdhci-of-arasan: Unregister all clock providers
Date: Wed, 4 Nov 2026 20:23:42 +0200 [thread overview]
Message-ID: <316d51ce-9a41-4bf4-b701-1da0cbe92bb3@intel.com> (raw)
In-Reply-To: <20261103100521.1309763-1-vulab@iscas.ac.cn>
On 03/11/2026 12:05, Wentao Liang wrote:
> When #clock-cells is non-zero, sdhci_arasan_register_sdclk() registers
> two clock providers for the same device node: one for the card clock and
> one for the sample clock. of_clk_add_provider() takes a reference to
> the device node for each registration, but the unregister helper only
> calls of_clk_del_provider() once. The second device node reference is
> therefore leaked and the sample clock provider remains registered after
> the driver has been unbound.
>
> Drop one provider for every clock that was registered.
>
> Fixes: 07a14d1df454 ("mmc: sdhci-of-arasan: Add sampling clock for a phy to use")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
"Assisted-by" tag is not used anymore
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Looks OK to me but maybe someone who uses this code could
review or test it, since Krzysztof has cast some doubt on the
contributor.
> ---
> drivers/mmc/host/sdhci-of-arasan.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 0ee22923ad56..dccd2980fdd6 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -1648,11 +1648,20 @@ sdhci_arasan_register_sampleclk(struct sdhci_arasan_data *sdhci_arasan,
> static void sdhci_arasan_unregister_sdclk(struct device *dev)
> {
> struct device_node *np = dev->of_node;
> + u32 num_clks = 0;
>
> - if (!of_property_present(np, "#clock-cells"))
> + if (of_property_read_u32(np, "#clock-cells", &num_clks) < 0)
> return;
>
> - of_clk_del_provider(dev->of_node);
> + of_clk_del_provider(np);
> +
> + /*
> + * sdhci_arasan_register_sdclk() registers a second provider for the
> + * sample clock when #clock-cells is non-zero, and each provider holds
> + * its own reference to the device node.
> + */
> + if (num_clks)
> + of_clk_del_provider(np);
> }
>
> /**
prev parent reply other threads:[~2026-11-04 18:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:05 Wentao Liang
2026-11-03 10:26 ` Krzysztof Kozlowski
2026-11-04 18:23 ` Adrian Hunter [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=316d51ce-9a41-4bf4-b701-1da0cbe92bb3@intel.com \
--to=adrian.hunter@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=stable@vger.kernel.org \
--cc=swati.agarwal@amd.com \
--cc=ulfh@kernel.org \
--cc=vulab@iscas.ac.cn \
/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
all inboxes | Powered by JetHome®