Skip to content

Commit 908981d

Browse files
Lifeng Zhengrafaeljw
authored andcommitted
cpufreq: Move the check of cpufreq_driver->get into cpufreq_verify_current_freq()
Move the check of cpufreq_driver->get into cpufreq_verify_current_freq() in case of calling it without check. Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com> Link: https://patch.msgid.link/20250709104145.2348017-4-zhenglifeng1@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent d1378d1 commit 908981d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,9 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b
18001800
{
18011801
unsigned int new_freq;
18021802

1803+
if (!cpufreq_driver->get)
1804+
return 0;
1805+
18031806
new_freq = cpufreq_driver->get(policy->cpu);
18041807
if (!new_freq)
18051808
return 0;
@@ -1922,10 +1925,7 @@ unsigned int cpufreq_get(unsigned int cpu)
19221925

19231926
guard(cpufreq_policy_read)(policy);
19241927

1925-
if (cpufreq_driver->get)
1926-
return __cpufreq_get(policy);
1927-
1928-
return 0;
1928+
return __cpufreq_get(policy);
19291929
}
19301930
EXPORT_SYMBOL(cpufreq_get);
19311931

@@ -2479,8 +2479,7 @@ int cpufreq_start_governor(struct cpufreq_policy *policy)
24792479

24802480
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
24812481

2482-
if (cpufreq_driver->get)
2483-
cpufreq_verify_current_freq(policy, false);
2482+
cpufreq_verify_current_freq(policy, false);
24842483

24852484
if (policy->governor->start) {
24862485
ret = policy->governor->start(policy);

0 commit comments

Comments
 (0)