linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: [PATCH] topology/sysfs: Fix allnoconfig build breakage.
Date: Thu, 21 Apr 2022 17:53:57 +0200	[thread overview]
Message-ID: <YmF+FTxgu2U4/oPA@kroah.com> (raw)
In-Reply-To: <YmF8Hrq5kgDdfvtS@agluck-desk3.sc.intel.com>

On Thu, Apr 21, 2022 at 08:45:34AM -0700, Luck, Tony wrote:
> drivers/base/topology.c: In function 'topology_is_visible':
> drivers/base/topology.c:158:24: warning: unused variable 'dev' [-Wunused-variable]
>   158 |         struct device *dev = kobj_to_dev(kobj);
> 
> This is because the topology_ppin(dev->id) macro expands to:
> 
> 	(cpu_data(dev->id).ppin)
> 
> and with CONFIG_SMP=n the cpu_data() macro expands to boot_cpu_data
> (ignoring its argument) with the end result:
> 
> 	boot_cpu_data.ppin
> 
> My CPP-fu wasn't up to a modification to topology_ppin(), so I added a
> (probably redundant) check for "dev" being a NULL pointer.
> 
> Fixes: c3702a746ff5 ("topology/sysfs: Hide PPIN on systems that do not support it.")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> 
> ---
> Better fixes with clever CPP macro tricks gratefully welcomed
> ---
>  drivers/base/topology.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/topology.c b/drivers/base/topology.c
> index 706dbf8bf249..31fae51fd340 100644
> --- a/drivers/base/topology.c
> +++ b/drivers/base/topology.c
> @@ -157,7 +157,7 @@ static umode_t topology_is_visible(struct kobject *kobj,
>  {
>  	struct device *dev = kobj_to_dev(kobj);
>  
> -	if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
> +	if (!dev || (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id)))

!dev is impossible to ever hit, that's the sign that the code is wrong
and needs to be fixed :(

Sorry, this is not going to be an acceptable change.

greg k-h

  reply	other threads:[~2022-04-21 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  5:26 linux-next: build warning after merge of the driver-core.current tree Stephen Rothwell
2022-04-21  6:49 ` Greg KH
2022-04-21 15:45   ` [PATCH] topology/sysfs: Fix allnoconfig build breakage Luck, Tony
2022-04-21 15:53     ` Greg KH [this message]
2022-04-21 16:19       ` [PATCH v2] " Luck, Tony
2022-04-21 23:22         ` Stephen Rothwell
2022-04-21 23:38           ` Luck, Tony
2022-04-22  0:00             ` Stephen Rothwell
2022-04-22  2:51               ` Luck, Tony
2022-04-22  6:00                 ` Greg KH
2022-04-22  6:27                   ` Greg KH

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=YmF+FTxgu2U4/oPA@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tony.luck@intel.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).