lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea80d7ce-4e5b-4817-a795-6400835c252d@huawei.com>
Date: Fri, 4 Jul 2025 17:37:15 +0800
From: "zhenglifeng (A)" <zhenglifeng1@...wei.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
CC: <viresh.kumar@...aro.org>, <ionela.voinescu@....com>,
	<linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>,
	<linuxarm@...wei.com>, <jonathan.cameron@...wei.com>,
	<zhanjie9@...ilicon.com>, <lihuisong@...wei.com>, <yubowen8@...wei.com>
Subject: Re: [PATCH 6/7] cpufreq: Refactor code about starting governor in
 cpufreq_set_policy()

On 2025/6/23 23:13, Rafael J. Wysocki wrote:

> On Mon, Jun 23, 2025 at 3:34 PM Lifeng Zheng <zhenglifeng1@...wei.com> wrote:
>>
>> Refactor code about starting governor without functional change in
>> cpufreq_set_policy() to make it more readable.
> 
> Sorry, but I don't see the point.

Just some refactoring to reduce nest level and make the style more similar
to other code in this file. If you don't like it, I'll drop it.

> 
>> Signed-off-by: Lifeng Zheng <zhenglifeng1@...wei.com>
>> ---
>>  drivers/cpufreq/cpufreq.c | 16 ++++++++++------
>>  1 file changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 9b2578b905a5..7b82ffb50283 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -2698,15 +2698,19 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
>>         /* start new governor */
>>         policy->governor = new_gov;
>>         ret = cpufreq_init_governor(policy);
>> -       if (!ret) {
>> -               ret = cpufreq_start_governor(policy);
>> -               if (!ret) {
>> -                       pr_debug("governor change\n");
>> -                       return 0;
>> -               }
>> +       if (ret)
>> +               goto start_old_gov;
>> +
>> +       ret = cpufreq_start_governor(policy);
>> +       if (ret) {
>>                 cpufreq_exit_governor(policy);
>> +               goto start_old_gov;
>>         }
>>
>> +       pr_debug("governor change\n");
>> +       return 0;
>> +
>> +start_old_gov:
>>         /* new governor failed, so re-start old one */
>>         pr_debug("starting governor %s failed\n", policy->governor->name);
>>         if (old_gov) {
>> --
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ