[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0igiz-VmmDC2qsZ3AhqjGhM54LHMLeLdZ7Dr=h5Dm9Rrg@mail.gmail.com>
Date: Tue, 14 Jul 2020 18:03:26 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Lee Jones <lee.jones@...aro.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Viresh Kumar <viresh.kumar@...aro.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Andy Grover <andrew.grover@...el.com>,
Paul Diefenbaugh <paul.s.diefenbaugh@...el.com>,
Dominik Brodowski <linux@...do.de>,
Denis Sadykov <denis.m.sadykov@...el.com>
Subject: Re: [PATCH 08/13] cpufreq: acpi-cpufreq: Take 'dummy' principle one
stage further
On Tue, Jul 14, 2020 at 4:51 PM Lee Jones <lee.jones@...aro.org> wrote:
>
> If we fail to use a variable, even a 'dummy' one, then the compiler
> complains that it is set but not used. We know this is fine, so we
> set it to its own value here.
Which is kind of ugly in my personal view. I hope that the compiler
will actually optimize the extra code away ...
> Fixes the following W=1 kernel build warning(s):
Well, "Makes the following ... warning(s) go away:" rather ...
> drivers/cpufreq/acpi-cpufreq.c: In function ‘cpu_freq_read_intel’:
> drivers/cpufreq/acpi-cpufreq.c:247:11: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
> drivers/cpufreq/acpi-cpufreq.c: In function ‘cpu_freq_read_amd’:
> drivers/cpufreq/acpi-cpufreq.c:265:11: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
>
> Cc: Andy Grover <andrew.grover@...el.com>
> Cc: Paul Diefenbaugh <paul.s.diefenbaugh@...el.com>
> Cc: Dominik Brodowski <linux@...do.de>
> Cc: Denis Sadykov <denis.m.sadykov@...el.com>
> Signed-off-by: Lee Jones <lee.jones@...aro.org>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 429e5a36c08a9..d38a693b48e03 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -247,6 +247,7 @@ static u32 cpu_freq_read_intel(struct acpi_pct_register *not_used)
> u32 val, dummy;
>
> rdmsr(MSR_IA32_PERF_CTL, val, dummy);
> + dummy &= dummy; /* Silence set but not used warning */
> return val;
> }
>
> @@ -264,6 +265,7 @@ static u32 cpu_freq_read_amd(struct acpi_pct_register *not_used)
> u32 val, dummy;
>
> rdmsr(MSR_AMD_PERF_CTL, val, dummy);
> + dummy &= dummy; /* Silence set but not used warning */
> return val;
> }
>
> --
> 2.25.1
>
Powered by blists - more mailing lists