[PATCH 2/2] cpufreq: spear: Add a platform remove callback
Viresh Kumar
viresh.kumar at linaro.org
Mon Nov 30 00:45:44 PST 2026
On 27-11-26, 19:33, Tian Xuechen wrote:
> From: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
>
> The SPEAr platform device registers a cpufreq driver and retains the CPU
> clock and frequency table. Unbinding it leaves the driver and those
> resources registered.
>
> Unregister the cpufreq driver before dropping the clock reference and
> freeing the table.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: 2449d33a4055 ("cpufreq: SPEAr: Instantiate as platform_driver")
> Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
> ---
> drivers/cpufreq/spear-cpufreq.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
> index ffe5eda82f0b..91aeaa099f8f 100644
> --- a/drivers/cpufreq/spear-cpufreq.c
> +++ b/drivers/cpufreq/spear-cpufreq.c
> @@ -229,11 +229,19 @@ static int spear_cpufreq_probe(struct platform_device *pdev)
> return ret;
> }
>
> +static void spear_cpufreq_remove(struct platform_device *pdev)
> +{
> + cpufreq_unregister_driver(&spear_cpufreq_driver);
> + clk_put(spear_cpufreq.clk);
> + kfree(spear_cpufreq.freq_tbl);
> +}
This also can't be built as a module.. (like pinctrl).
--
viresh
More information about the linux-arm-kernel
mailing list