linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Zheng Yongjun <zhengyongjun3@huawei.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	linux-kernel@vger.kernel.org, Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH] arch/x86/amd: Remove set but not used variable 'active'
Date: Mon, 11 Nov 2019 08:31:06 +0100	[thread overview]
Message-ID: <20191111073106.GB112047@gmail.com> (raw)
In-Reply-To: <20191110094453.113001-1-zhengyongjun3@huawei.com>


* Zheng Yongjun <zhengyongjun3@huawei.com> wrote:

> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> arch/x86/events/amd/core.c: In function amd_pmu_handle_irq:
> arch/x86/events/amd/core.c:656:6: warning: variable active set but not used [-Wunused-but-set-variable]
> 
> active is never used, so remove it.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  arch/x86/events/amd/core.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
> index 64c3e70b0556..1ff652a167db 100644
> --- a/arch/x86/events/amd/core.c
> +++ b/arch/x86/events/amd/core.c
> @@ -653,14 +653,7 @@ static void amd_pmu_disable_event(struct perf_event *event)
>  static int amd_pmu_handle_irq(struct pt_regs *regs)
>  {
>  	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> -	int active, handled;
> -
> -	/*
> -	 * Obtain the active count before calling x86_pmu_handle_irq() since
> -	 * it is possible that x86_pmu_handle_irq() may make a counter
> -	 * inactive (through x86_pmu_stop).
> -	 */
> -	active = __bitmap_weight(cpuc->active_mask, X86_PMC_IDX_MAX);
> +	int handled;
>  
>  	/* Process any counter overflows */
>  	handled = x86_pmu_handle_irq(regs);

I'm sad that not only was this changelog of poor quality (you didn't 
follow title patterns, you didn't explain why the variable went unused, 
etc. etc.), you didn't even *build* the resulting file, which now 
produces a new warning on x86-64-defconfig:

  arch/x86/events/amd/core.c:655:24: warning: unused variable ‘cpuc’ [-Wunused-variable]

I fixed this up, but please be much more careful even with 'trivial' 
patches - we expect them to be perfect.

Thanks,

	Ingo

  parent reply	other threads:[~2019-11-11  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-10  9:44 [PATCH] arch/x86/amd: Remove set but not used variable 'active' Zheng Yongjun
2019-11-11  7:02 ` [tip: perf/core] perf/x86/amd: " tip-bot2 for Zheng Yongjun
2019-11-11  7:31 ` Ingo Molnar [this message]
2019-11-11  9:32 ` tip-bot2 for Zheng Yongjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191111073106.GB112047@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hulkci@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=zhengyongjun3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).