int pre_vproc;
 };
 
+static struct platform_device *cpufreq_pdev;
+
 static LIST_HEAD(dvfs_info_list);
 
 static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu)
 {
        struct device_node *np;
        const struct of_device_id *match;
-       struct platform_device *pdev;
        int err;
 
        np = of_find_node_by_path("/");
         * and the device registration codes are put here to handle defer
         * probing.
         */
-       pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0);
-       if (IS_ERR(pdev)) {
+       cpufreq_pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0);
+       if (IS_ERR(cpufreq_pdev)) {
                pr_err("failed to register mtk-cpufreq platform device\n");
                platform_driver_unregister(&mtk_cpufreq_platdrv);
-               return PTR_ERR(pdev);
+               return PTR_ERR(cpufreq_pdev);
        }
 
        return 0;
 
 static void __exit mtk_cpufreq_driver_exit(void)
 {
+       platform_device_unregister(cpufreq_pdev);
        platform_driver_unregister(&mtk_cpufreq_platdrv);
 }
 module_exit(mtk_cpufreq_driver_exit)