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

Message ID 20221108170103.3375832-1-nathan@kernel.org
State New
Headers
Series cpufreq: ACPI: Remove unused variables 'acpi_cpufreq_online' and 'ret' |

Commit Message

Nathan Chancellor Nov. 8, 2022, 5:01 p.m. UTC
  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")
Link: https://github.com/ClangBuiltLinux/linux/issues/1757
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/cpufreq/acpi-cpufreq.c | 6 ------
 1 file changed, 6 deletions(-)


base-commit: 21cdb6c18f85fe538ca8740bc79f11fbe08d0197
  

Comments

Nick Desaulniers Nov. 10, 2022, 10:05 p.m. UTC | #1
On Tue, Nov 8, 2022 at 9:01 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1757
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch!

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  drivers/cpufreq/acpi-cpufreq.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index c8fdfcf659e6..74ef0e05ff7b 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -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
>
  
Nathan Chancellor Nov. 16, 2022, 7:34 p.m. UTC | #2
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

On Tue, Nov 08, 2022 at 10:01:03AM -0700, Nathan Chancellor wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1757
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/cpufreq/acpi-cpufreq.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index c8fdfcf659e6..74ef0e05ff7b 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -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
>
  
Rafael J. Wysocki Nov. 16, 2022, 7:50 p.m. UTC | #3
On Wed, Nov 16, 2022 at 8:34 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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!

> On Tue, Nov 08, 2022 at 10:01:03AM -0700, Nathan Chancellor wrote:
> > 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")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1757
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >  drivers/cpufreq/acpi-cpufreq.c | 6 ------
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> > index c8fdfcf659e6..74ef0e05ff7b 100644
> > --- a/drivers/cpufreq/acpi-cpufreq.c
> > +++ b/drivers/cpufreq/acpi-cpufreq.c
> > @@ -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
> >
  
Nathan Chancellor Nov. 16, 2022, 7:58 p.m. UTC | #4
On Wed, Nov 16, 2022 at 08:50:41PM +0100, Rafael J. Wysocki wrote:
> On Wed, Nov 16, 2022 at 8:34 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > 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!

> > On Tue, Nov 08, 2022 at 10:01:03AM -0700, Nathan Chancellor wrote:
> > > 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")
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/1757
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > >  drivers/cpufreq/acpi-cpufreq.c | 6 ------
> > >  1 file changed, 6 deletions(-)
> > >
> > > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> > > index c8fdfcf659e6..74ef0e05ff7b 100644
> > > --- a/drivers/cpufreq/acpi-cpufreq.c
> > > +++ b/drivers/cpufreq/acpi-cpufreq.c
> > > @@ -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
> > >
  

Patch

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index c8fdfcf659e6..74ef0e05ff7b 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -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)