public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] x86/cacheinfo: Remove set but unused variable 'trace'
Date: Fri, 02 Dec 2022 14:04:05 +0100	[thread overview]
Message-ID: <87v8muot2y.ffs@tglx> (raw)
In-Reply-To: <20221123060106.29067-1-jiapeng.chong@linux.alibaba.com>

On Wed, Nov 23 2022 at 14:01, Jiapeng Chong wrote:

> Variable 'trace' is not effectively used in the function, so delete it.
>
> arch/x86/kernel/cpu/cacheinfo.c:737:15: warning: variable 'trace' set but not used.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3243

This link is really pointless.

> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  arch/x86/kernel/cpu/cacheinfo.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
> index f4e5aa27eec6..c6c0052def8e 100644
> --- a/arch/x86/kernel/cpu/cacheinfo.c
> +++ b/arch/x86/kernel/cpu/cacheinfo.c
> @@ -734,7 +734,7 @@ void init_hygon_cacheinfo(struct cpuinfo_x86 *c)
>  void init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  {
>  	/* Cache sizes */
> -	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0;
> +	unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0;
>  	unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
>  	unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
>  	unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
> @@ -836,7 +836,6 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
>  							l3 += cache_table[k].size;
>  							break;
>  						case LVL_TRACE:
> -							trace += cache_table[k].size;
>  							break;

Sure, that makes the warning go away, but what's the purpose of
'case LVL_TRACE:' now?

Now if you remove that you really want look at the surrounding logic of
LVL_TRACE. Hint: There is way more completely useless code to remove.

Thanks,

        tglx

      reply	other threads:[~2022-12-02 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  6:01 [PATCH] x86/cacheinfo: Remove set but unused variable 'trace' Jiapeng Chong
2022-12-02 13:04 ` Thomas Gleixner [this message]

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=87v8muot2y.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=abaci@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=x86@kernel.org \
    /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