[PATCH] cpufreq: loongson2: Unregister platform_driver on failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>
---
 drivers/cpufreq/loongson2_cpufreq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index 6a8e97896d38..1291db067559 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -153,6 +153,9 @@ static int __init cpufreq_init(void)
 		cpu_wait = loongson2_cpu_wait;
 	}
 
+	if (ret)
+		platform_driver_unregister(&platform_driver);
+
 	return ret;
 }
 
-- 
2.17.1





[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux