Re: [PATCH v1] clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()
Brian Masney <[email protected]> Mon, 3 Aug 2026 09:28:56 -0400
| Newsgroups | org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Aug 01, 2026 at 02:16:34PM +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/[email protected] > > Fixes: 9934a1bd45b2 ("clk: provide devm_clk_get_optional_enabled_with_rate()") > Signed-off-by: Onur Özkan <[email protected]> Reviewed-by: Brian Masney <[email protected]>