Re: [PATCH v2] clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()
From: Onur Özkan
Date: Thu Sep 03 2026 - 03:46:24 EST
On Wed, 02 Sep 2026 17:58:13 -0400
Brian Masney <bmasney@xxxxxxxxxx> wrote:
> Hi Onur,
>
> On Sun, Aug 09, 2026 at 12:54:04PM +0300, Onur Özkan wrote:
> > devm_clk_get_optional_enabled_with_rate() registers its cleanup action
> > before setting the clock rate. If setting the rate fails, it attempts to
> > disable and unprepare a clock that was never enabled. This issue was
> > spotted while reviewing "rust: clk: add devres-managed clks" [1].
> >
> > Register the cleanup action only after successfully preparing and enabling
> > the clock.
> >
> > [1]: https://lore.kernel.org/rust-for-linux/20260706-clk-type-state-v5-3-67c5f326a16c@xxxxxxxxxxxxx
> >
> > Fixes: 9934a1bd45b2 ("clk: provide devm_clk_get_optional_enabled_with_rate()")
> > Reviewed-by: Brian Masney <bmasney@xxxxxxxxxx>
> > Signed-off-by: Onur Özkan <work@xxxxxxxxxxxxx>
>
> This series no longer applies against the latest clk-next branch. Can you
> rebase this, and submit a new version? I'll be able to pick it up quickly.
>
> Thanks,
>
> Brian
>
Hi Brian,
It seems that the fix has already been applied, but v1 was picked instead of v2.
I sent v2 the next day after receiving warnings from the kernel bot [1], at
which point v1 had not yet been applied anywhere.
[1]: https://lore.kernel.org/all/202608090025.dwxdfqFr-lkp@xxxxxxxxx
So this patch itself is no longer necessary since the fix is already there. If
you still want to get rid of the warnings I can send another patch for it.
- Onur