Skip to contentSkip to conversation

cpufreq: intel_pstate: Rearrange variable declaration involving __free()

PATCH In review Rafael J. Wysocki 4 participants 4 messages Sep 3, 2025 – Sep 4, 2025

Subsystems (2)
lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 cpufreq: intel_pstate: Rearrange variable declaration involving __free()

From: Rafael J. Wysocki <[email protected]>

Follow cleanup.h recommendations and define and assign a variable in one statement when __free() is used.

No intentional functional impact.

---

Zhang, I said the code structure here was intentional, but that was before the cleanup.h recommendation was pointed out to me.

---
 drivers/cpufreq/intel_pstate.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +1 -3
@@ -1502,9 +1502,7 @@ static void __intel_pstate_update_max_fr
 
 static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
 {
-	struct cpufreq_policy *policy __free(put_cpufreq_policy);
-
-	policy = cpufreq_cpu_get(cpudata->cpu);
+	struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
 	if (!policy)
 		return false;
 
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Rafael J. Wysocki
Quoted 22 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Follow cleanup.h recommendations and define and assign a variable in one statement when __free() is used.

No intentional functional impact.

---

Zhang, I said the code structure here was intentional, but that was before the cleanup.h recommendation was pointed out to me.

---
 drivers/cpufreq/intel_pstate.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

drivers/cpufreq/intel_pstate.c static void __intel_pstate_update_max_fr · line 1508

Quoted 10 lines
drivers/cpufreq/intel_pstate.c +1 -3
@@ -1502,9 +1502,7 @@ static void __intel_pstate_update_max_fr
 
 static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
 {
-	struct cpufreq_policy *policy __free(put_cpufreq_policy);
-
-	policy = cpufreq_cpu_get(cpudata->cpu);
+	struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
 	if (!policy)
 		return false;
 
Signature · 1 line
viresh
Reviewed-by
#3 lore raw
Quoted 23 lines · Rafael J. Wysocki
Quoted 21 lines

From: Rafael J. Wysocki <[email protected]>

Follow cleanup.h recommendations and define and assign a variable in one statement when __free() is used.

No intentional functional impact.

---

Zhang, I said the code structure here was intentional, but that was before the cleanup.h recommendation was pointed out to me.

---
  drivers/cpufreq/intel_pstate.c |    4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/intel_pstate.c +0 -0
@@ -1502,9 +1502,7 @@ static void __intel_pstate_update_max_fr
 
Quoted 9 lines

drivers/cpufreq/intel_pstate.c static void __intel_pstate_update_max_fr · line 1508

Quoted 9 lines
drivers/cpufreq/intel_pstate.c +1 -3
  static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
  {
-	struct cpufreq_policy *policy __free(put_cpufreq_policy);
-
-	policy = cpufreq_cpu_get(cpudata->cpu);
+	struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
  	if (!policy)
  		return false;