Re: [PATCH v2] clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()

From: Brian Masney

Date: Wed Sep 02 2026 - 18:01:56 EST


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