cpufreq: brcmstb-avs-cpufreq: Free resources in error path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 17 Jan 2021 14:26:35 +0000 (15:26 +0100)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 18 Jan 2021 06:53:28 +0000 (12:23 +0530)
commit05f456286fd489558c72a4711d22a5612c965685
treea071ba9be838289a8c4718b21334a4657411f688
parent266991721c15f9feb5c4b839cb1bdde4a2b20030
cpufreq: brcmstb-avs-cpufreq: Free resources in error path

If 'cpufreq_register_driver()' fails, we must release the resources
allocated in 'brcm_avs_prepare_init()' as already done in the remove
function.

To do that, introduce a new function 'brcm_avs_prepare_uninit()' in order
to avoid code duplication. This also makes the code more readable (IMHO).

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[ Viresh: Updated Subject ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/brcmstb-avs-cpufreq.c