On 2026-10-27T18:40:16, Yuho Choi <[email protected]> wrote:
> clk: Disable parent clock when clk_enable() fails
>
> With CONFIG_CLK_CCF, clk_enable() on a clock that is registered by id
> and has an enable_count of zero first enables the parent clock if the
> parent device is a clock, and only then calls the clock's own enable
> op. If that op fails, for example because clk_fracn_gppll_prepare()
> returns -ETIMEDOUT when an i.MX93 PLL does not lock, clk_enable()
> returns the error without undoing the parent enable.
>
> The enable_count of the clock itself is not incremented in that case, so
> a later clk_disable() of it returns early with "already disabled" and
> never propagates to the parent. Every failed attempt therefore leaves
> the parent's enable_count one higher, and the parent stays enabled even
> after all of its real users have disabled it.
>
> Disable the parent again when the enable op fails, the same way
> clk_disable() drops the parent reference when the last user of a clock
> goes away.
>
> Fixes: 0520be0f67e3 ("clk: prograte clk enable/disable to parent")
> Signed-off-by: Yuho Choi <[email protected]>
>
>  drivers/clk/clk-uclass.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to