[PATCH] cpufreq: apple-soc: Add missing OPP table cleanup on init failure

Viresh Kumar viresh.kumar at linaro.org
Mon Jun 22 01:25:42 PDT 2026


On 22-06-26, 14:31, Haoxiang Li wrote:
> apple_soc_cpufreq_init() adds the OPP table with
> dev_pm_opp_of_add_table(), but some later error
> paths can return without removing it.
> 
> Add the missing dev_pm_opp_of_remove_table() call
> to clean up the OPP table on init failure.
> 
> Signed-off-by: Haoxiang Li <haoxiang_li2024 at 163.com>
> ---
>  drivers/cpufreq/apple-soc-cpufreq.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c
> index 9396034167e5..4dae968e84df 100644
> --- a/drivers/cpufreq/apple-soc-cpufreq.c
> +++ b/drivers/cpufreq/apple-soc-cpufreq.c
> @@ -260,7 +260,7 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy)
>  	ret = apple_soc_cpufreq_find_cluster(policy, &reg_base, &info);
>  	if (ret) {
>  		dev_err(cpu_dev, "%s: failed to get cluster info: %d\n", __func__, ret);
> -		return ret;
> +		goto out_remove_table;
>  	}
>  
>  	ret = dev_pm_opp_set_sharing_cpus(cpu_dev, policy->cpus);
> @@ -326,6 +326,8 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy)
>  	dev_pm_opp_remove_all_dynamic(cpu_dev);

This driver doesn't add any dynamic (non DT) OPPs, looks like this is incorrect
?

>  out_iounmap:
>  	iounmap(reg_base);
> +out_remove_table:
> +	dev_pm_opp_of_remove_table(cpu_dev);

This is also required to be done in apple_soc_cpufreq_exit() ?

>  	return ret;
>  }

-- 
viresh



More information about the linux-arm-kernel mailing list