Skip to contentSkip to conversation

cpufreq: ACPI: Remove unused variables 'acpi_cpufreq_online' and 'ret'

PATCH In review Nathan Chancellor 3 participants 5 messages Nov 8, 2022 – Nov 16, 2022 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: ACPI: Remove unused variables 'acpi_cpufreq_online' and 'ret'

Clang warns:

drivers/cpufreq/acpi-cpufreq.c:970:24: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

          acpi_cpufreq_online = ret;
                                ^~~
  drivers/cpufreq/acpi-cpufreq.c:960:9: note: initialize the variable 'ret' to silence this warning
          int ret;
                ^
                  = 0

1 error generated.

Both ret and acpi_cpufreq_online are now unused so they can be safely removed, clearing up the warning.

Fixes 13fdbc8b8da6 ("cpufreq: ACPI: Defer setting boost MSRs")
---
 drivers/cpufreq/acpi-cpufreq.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +0 -6
index c8fdfcf659e6..74ef0e05ff7b 100644
@@ -953,12 +953,8 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
 	.attr		= acpi_cpufreq_attr,
 };
 
-static enum cpuhp_state acpi_cpufreq_online;
-
 static void __init acpi_cpufreq_boost_init(void)
 {
-	int ret;
-
 	if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA))) {
 		pr_debug("Boost capabilities not present in the processor\n");
 		return;
@@ -966,8 +962,6 @@ static void __init acpi_cpufreq_boost_init(void)
 
 	acpi_cpufreq_driver.set_boost = set_boost;
 	acpi_cpufreq_driver.boost_enabled = boost_state(0);
-
-	acpi_cpufreq_online = ret;
 }
 
 static int __init acpi_cpufreq_init(void)

base-commit: 21cdb6c18f85fe538ca8740bc79f11fbe08d0197

Signature · 1 line
2.38.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Nathan Chancellor

Clang warns:

drivers/cpufreq/acpi-cpufreq.c:970:24: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

          acpi_cpufreq_online = ret;
                                ^~~
  drivers/cpufreq/acpi-cpufreq.c:960:9: note: initialize the variable 'ret' to silence this warning
          int ret;
                ^
                  = 0
Quoted 8 lines

1 error generated.

Both ret and acpi_cpufreq_online are now unused so they can be safely removed, clearing up the warning.

Fixes 13fdbc8b8da6 ("cpufreq: ACPI: Defer setting boost MSRs")

Thanks for the patch!

Quoted 35 lines
---
 drivers/cpufreq/acpi-cpufreq.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +0 -6
index c8fdfcf659e6..74ef0e05ff7b 100644
@@ -953,12 +953,8 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
        .attr           = acpi_cpufreq_attr,
 };
 
-static enum cpuhp_state acpi_cpufreq_online;
-
 static void __init acpi_cpufreq_boost_init(void)
 {
-       int ret;
-
        if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA))) {
                pr_debug("Boost capabilities not present in the processor\n");
                return;
@@ -966,8 +962,6 @@ static void __init acpi_cpufreq_boost_init(void)
 
        acpi_cpufreq_driver.set_boost = set_boost;
        acpi_cpufreq_driver.boost_enabled = boost_state(0);
-
-       acpi_cpufreq_online = ret;
 }
 
 static int __init acpi_cpufreq_init(void)

base-commit: 21cdb6c18f85fe538ca8740bc79f11fbe08d0197 --
2.38.1

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
In reply to Nathan Chancellor

Hi all,

Small ping, was there an issue with this change? It seems pretty straight forward to me and it is wreaking havoc on our build matrix due to -Werror.

Cheers,
Nathan

Quoted 52 lines · Nathan Chancellor

Clang warns:

drivers/cpufreq/acpi-cpufreq.c:970:24: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

          acpi_cpufreq_online = ret;
                                ^~~
  drivers/cpufreq/acpi-cpufreq.c:960:9: note: initialize the variable 'ret' to silence this warning
          int ret;
                ^
                  = 0

1 error generated.

Both ret and acpi_cpufreq_online are now unused so they can be safely removed, clearing up the warning.

Fixes 13fdbc8b8da6 ("cpufreq: ACPI: Defer setting boost MSRs")
---
 drivers/cpufreq/acpi-cpufreq.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +0 -6
index c8fdfcf659e6..74ef0e05ff7b 100644
@@ -953,12 +953,8 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
 	.attr		= acpi_cpufreq_attr,
 };
 
-static enum cpuhp_state acpi_cpufreq_online;
-
 static void __init acpi_cpufreq_boost_init(void)
 {
-	int ret;
-
 	if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA))) {
 		pr_debug("Boost capabilities not present in the processor\n");
 		return;
@@ -966,8 +962,6 @@ static void __init acpi_cpufreq_boost_init(void)
 
 	acpi_cpufreq_driver.set_boost = set_boost;
 	acpi_cpufreq_driver.boost_enabled = boost_state(0);
-
-	acpi_cpufreq_online = ret;
 }
 
 static int __init acpi_cpufreq_init(void)

base-commit: 21cdb6c18f85fe538ca8740bc79f11fbe08d0197

Signature · 1 line
2.38.1
#3 lore raw
Quoted 6 lines · Nathan Chancellor

Hi all,

Small ping, was there an issue with this change? It seems pretty straight forward to me and it is wreaking havoc on our build matrix due to -Werror.

Applied now, thanks!

Quoted 53 lines · Nathan Chancellor
Quoted 52 lines

Clang warns:

drivers/cpufreq/acpi-cpufreq.c:970:24: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

          acpi_cpufreq_online = ret;
                                ^~~
  drivers/cpufreq/acpi-cpufreq.c:960:9: note: initialize the variable 'ret' to silence this warning
          int ret;
                ^
                  = 0

1 error generated.

Both ret and acpi_cpufreq_online are now unused so they can be safely removed, clearing up the warning.

Fixes 13fdbc8b8da6 ("cpufreq: ACPI: Defer setting boost MSRs")
---
 drivers/cpufreq/acpi-cpufreq.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +0 -6
index c8fdfcf659e6..74ef0e05ff7b 100644
@@ -953,12 +953,8 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
      .attr           = acpi_cpufreq_attr,
 };
 
-static enum cpuhp_state acpi_cpufreq_online;
-
 static void __init acpi_cpufreq_boost_init(void)
 {
-     int ret;
-
      if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA))) {
              pr_debug("Boost capabilities not present in the processor\n");
              return;
@@ -966,8 +962,6 @@ static void __init acpi_cpufreq_boost_init(void)
 
      acpi_cpufreq_driver.set_boost = set_boost;
      acpi_cpufreq_driver.boost_enabled = boost_state(0);
-
-     acpi_cpufreq_online = ret;
 }
 
 static int __init acpi_cpufreq_init(void)

base-commit: 21cdb6c18f85fe538ca8740bc79f11fbe08d0197 --
2.38.1

#4 lore raw
Quoted 9 lines · Rafael J. Wysocki
Quoted 6 lines · Nathan Chancellor

Hi all,

Small ping, was there an issue with this change? It seems pretty straight forward to me and it is wreaking havoc on our build matrix due to -Werror.

Applied now, thanks!

Thanks a lot!

Quoted 53 lines
Quoted 53 lines · Nathan Chancellor
Quoted 52 lines

Clang warns:

drivers/cpufreq/acpi-cpufreq.c:970:24: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

          acpi_cpufreq_online = ret;
                                ^~~
  drivers/cpufreq/acpi-cpufreq.c:960:9: note: initialize the variable 'ret' to silence this warning
          int ret;
                ^
                  = 0

1 error generated.

Both ret and acpi_cpufreq_online are now unused so they can be safely removed, clearing up the warning.

Fixes 13fdbc8b8da6 ("cpufreq: ACPI: Defer setting boost MSRs")
---
 drivers/cpufreq/acpi-cpufreq.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +0 -6
index c8fdfcf659e6..74ef0e05ff7b 100644
@@ -953,12 +953,8 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
      .attr           = acpi_cpufreq_attr,
 };
 
-static enum cpuhp_state acpi_cpufreq_online;
-
 static void __init acpi_cpufreq_boost_init(void)
 {
-     int ret;
-
      if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA))) {
              pr_debug("Boost capabilities not present in the processor\n");
              return;
@@ -966,8 +962,6 @@ static void __init acpi_cpufreq_boost_init(void)
 
      acpi_cpufreq_driver.set_boost = set_boost;
      acpi_cpufreq_driver.boost_enabled = boost_state(0);
-
-     acpi_cpufreq_online = ret;
 }
 
 static int __init acpi_cpufreq_init(void)

base-commit: 21cdb6c18f85fe538ca8740bc79f11fbe08d0197 --
2.38.1