hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/cpufreq/s3c2416-cpufreq.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * S3C2416/2450 CPUfreq Support
34 *
....@@ -6,10 +7,6 @@
67 * based on s3c64xx_cpufreq.c
78 *
89 * Copyright 2009 Wolfson Microelectronics plc
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1310 */
1411
1512 #include <linux/kernel.h>
....@@ -307,6 +304,7 @@
307304 {
308305 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
309306 int ret;
307
+ struct cpufreq_policy *policy;
310308
311309 mutex_lock(&cpufreq_lock);
312310
....@@ -321,7 +319,16 @@
321319 */
322320 if (s3c_freq->is_dvs) {
323321 pr_debug("cpufreq: leave dvs on reboot\n");
324
- ret = cpufreq_driver_target(cpufreq_cpu_get(0), FREQ_SLEEP, 0);
322
+
323
+ policy = cpufreq_cpu_get(0);
324
+ if (!policy) {
325
+ pr_debug("cpufreq: get no policy for cpu0\n");
326
+ return NOTIFY_BAD;
327
+ }
328
+
329
+ ret = cpufreq_driver_target(policy, FREQ_SLEEP, 0);
330
+ cpufreq_cpu_put(policy);
331
+
325332 if (ret < 0)
326333 return NOTIFY_BAD;
327334 }
....@@ -450,21 +457,16 @@
450457 /* Datasheet says PLL stabalisation time must be at least 300us,
451458 * so but add some fudge. (reference in LOCKCON0 register description)
452459 */
453
- ret = cpufreq_generic_init(policy, s3c_freq->freq_table,
460
+ cpufreq_generic_init(policy, s3c_freq->freq_table,
454461 (500 * 1000) + s3c_freq->regulator_latency);
455
- if (ret)
456
- goto err_freq_table;
457
-
458462 register_reboot_notifier(&s3c2416_cpufreq_reboot_notifier);
459463
460464 return 0;
461465
462
-err_freq_table:
463466 #ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE
464
- regulator_put(s3c_freq->vddarm);
465467 err_vddarm:
466
-#endif
467468 clk_put(s3c_freq->armclk);
469
+#endif
468470 err_armclk:
469471 clk_put(s3c_freq->hclk);
470472 err_hclk: