On 16-10-24, 17:06, Yuan Can wrote: > 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: f8ede0f700f5 ("MIPS: Loongson 2F: Add CPU frequency scaling support") > Signed-off-by: Yuan Can <yuancan@xxxxxxxxxx> > --- > Changes since v1: > - Change to style suggested by Viresh Kumar. > --- > drivers/cpufreq/loongson2_cpufreq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c > index 6a8e97896d38..ed1a6dbad638 100644 > --- a/drivers/cpufreq/loongson2_cpufreq.c > +++ b/drivers/cpufreq/loongson2_cpufreq.c > @@ -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; > } Applied. Thanks. -- viresh