Skip to content

Commit

Permalink
cpufreq: loongson2: Unregister platform_driver on failure
Browse files Browse the repository at this point in the history
When cpufreq_register_driver() returns error, the cpufreq_init() returns
without unregister platform_driver, fix by add missing
platform_driver_unregister() when cpufreq_register_driver() failed.

Fixes: f8ede0f ("MIPS: Loongson 2F: Add CPU frequency scaling support")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
  • Loading branch information
Yuan Can authored and vireshk committed Oct 16, 2024
1 parent 41baf66 commit 5f856d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/cpufreq/loongson2_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ static int __init cpufreq_init(void)

ret = cpufreq_register_driver(&loongson2_cpufreq_driver);

if (!ret && !nowait) {
if (ret) {
platform_driver_unregister(&platform_driver);
} else if (!nowait) {
saved_cpu_wait = cpu_wait;
cpu_wait = loongson2_cpu_wait;
}
Expand Down

0 comments on commit 5f856d7

Please sign in to comment.