[PATCH] ASoC: mxs-saif: unregister the mclk if adding the provider fails

Mark Brown broonie at kernel.org
Wed Nov 4 10:20:25 PST 2026


> clk_register_divider() registers the mclk, while of_clk_add_provider() only
> stores it as the provider data. If of_clk_add_provider() fails, the clock
> stays registered but no provider refers to it, and the driver has no remove
> callback to release it, so the clock is leaked.
> 
> Unregister the clock on this error path before returning.

>  	ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
> -	if (ret)
> +	if (ret) {
> +		clk_unregister(clk);

We registered with clk_register_divider(), we should unregister with
clk_unregister_divider().

-- 
Mark Brown <broonie at kernel.org>



More information about the linux-arm-kernel mailing list