public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "tglx@linutronix.de" <tglx@linutronix.de>,
	"jgross@suse.com" <jgross@suse.com>,
	"x86@kernel.org" <x86@kernel.org>, "bp@alien8.de" <bp@alien8.de>
Subject: Re: [PATCH 1/4] x86/cpu: Add and use new CPUID region helper
Date: Mon, 25 Mar 2024 12:24:15 +0000	[thread overview]
Message-ID: <d33b97aecfe09cab31ebf06de3e02b633314ae9d.camel@intel.com> (raw)
In-Reply-To: <20240322175630.72CE974F@davehans-spike.ostc.intel.com>


Nit:

> +
> +/* Returns true if the leaf exists and @value was populated */

						 ^ is ?

> +static inline bool get_cpuid_region_leaf(u32 leaf, enum cpuid_regs_idx reg,
> +					 u32 *value)
> +{
> +	u16 region = leaf >> 16;
> +	u32 regs[4];
> +
> +	if (cpuid_region_max_leaf(region) < leaf)
> +		return false;
> +
> +	cpuid(leaf, &regs[CPUID_EAX], &regs[CPUID_EBX],
> +	            &regs[CPUID_ECX], &regs[CPUID_EDX]);
> +
> +	*value = regs[reg];
> +
> +	return true;
> +}

I found despite the get_cpuid_region_leaf() returns true/false, the return value
is never used in this series.  Instead, this series uses below pattern:

	u32 data = 0; 	/* explicit initialization */

	get_cpuid_region_leaf(leaf, ..., &data);

Which kinda implies the 'data' won't be touched if the requested leaf isn't
supported I suppose?

Since the return value is never used, should we consider just making this
function void?

  parent reply	other threads:[~2024-03-25 12:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 17:56 [PATCH 0/4] x86: Add CPUID region helper and clarify Xen startup Dave Hansen
2024-03-22 17:56 ` [PATCH 1/4] x86/cpu: Add and use new CPUID region helper Dave Hansen
2024-03-24  4:38   ` Ingo Molnar
2024-03-25 12:24   ` Huang, Kai [this message]
2024-04-02 17:13     ` Dave Hansen
2024-04-03 10:33       ` Huang, Kai
2024-04-04 23:35   ` Chang S. Bae
2024-03-22 17:56 ` [PATCH 2/4] perf/x86/ibs: Use " Dave Hansen
2024-03-22 17:56 ` [PATCH 3/4] x86/boot: Explicitly pass NX enabling status Dave Hansen
2024-03-25 12:04   ` Huang, Kai
2024-03-22 17:56 ` [PATCH 4/4] x86/xen: Enumerate NX from CPUID directly Dave Hansen
  -- strict thread matches above, loose matches on Subject: below --
2024-04-03 15:35 [PATCH 0/4] [v2] x86: Add CPUID region helper and clarify Xen startup Dave Hansen
2024-04-03 15:35 ` [PATCH 1/4] x86/cpu: Add and use new CPUID region helper Dave Hansen
2024-04-04  9:04   ` Jürgen Groß
2024-04-08 16:25     ` Borislav Petkov

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=d33b97aecfe09cab31ebf06de3e02b633314ae9d.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --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