Skip to content

Commit

Permalink
cpufreq/amd-pstate-ut: Adjust variable scope
Browse files Browse the repository at this point in the history
In amd_pstate_ut_check_freq() and amd_pstate_ut_check_perf() the cpudata
variable is only needed in the scope of the for loop. Move it there.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Reviewed-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
  • Loading branch information
Mario Limonciello committed Mar 6, 2025
1 parent 2aac38a commit c630458
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/amd-pstate-ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ static int amd_pstate_ut_check_perf(u32 index)
u32 highest_perf = 0, nominal_perf = 0, lowest_nonlinear_perf = 0, lowest_perf = 0;
u64 cap1 = 0;
struct cppc_perf_caps cppc_perf;
struct amd_cpudata *cpudata = NULL;
union perf_cached cur_perf;

for_each_online_cpu(cpu) {
struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL;
struct amd_cpudata *cpudata;

policy = cpufreq_cpu_get(cpu);
if (!policy)
Expand Down Expand Up @@ -186,10 +186,10 @@ static int amd_pstate_ut_check_perf(u32 index)
static int amd_pstate_ut_check_freq(u32 index)
{
int cpu = 0;
struct amd_cpudata *cpudata = NULL;

for_each_online_cpu(cpu) {
struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL;
struct amd_cpudata *cpudata;

policy = cpufreq_cpu_get(cpu);
if (!policy)
Expand Down

0 comments on commit c630458

Please sign in to comment.