public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] topology: Fix up build warning in topology_is_visible()
@ 2022-04-22  6:26 Greg Kroah-Hartman
  2022-04-23 10:53 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-22  6:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Stephen Rothwell, Tony Luck

Commit aa63a74d4535 ("topology/sysfs: Hide PPIN on systems that do not
support it.") caused a build warning on some configurations:

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);

Fix this up by getting rid of the variable entirely.

Fixes: aa63a74d4535 ("topology/sysfs: Hide PPIN on systems that do not support it.")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 706dbf8bf249..ac6ad9ab67f9 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -155,9 +155,7 @@ static struct attribute *default_attrs[] = {
 static umode_t topology_is_visible(struct kobject *kobj,
 				   struct attribute *attr, int unused)
 {
-	struct device *dev = kobj_to_dev(kobj);
-
-	if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
+	if (attr == &dev_attr_ppin.attr && !topology_ppin(kobj_to_dev(kobj)->id))
 		return 0;
 
 	return attr->mode;
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] topology: Fix up build warning in topology_is_visible()
  2022-04-22  6:26 [PATCH] topology: Fix up build warning in topology_is_visible() Greg Kroah-Hartman
@ 2022-04-23 10:53 ` Greg Kroah-Hartman
  2022-04-24 18:08   ` Luck, Tony
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-23 10:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stephen Rothwell, Tony Luck

On Fri, Apr 22, 2022 at 08:26:53AM +0200, Greg Kroah-Hartman wrote:
> Commit aa63a74d4535 ("topology/sysfs: Hide PPIN on systems that do not
> support it.") caused a build warning on some configurations:
> 
> 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);
> 
> Fix this up by getting rid of the variable entirely.
> 
> Fixes: aa63a74d4535 ("topology/sysfs: Hide PPIN on systems that do not support it.")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: Tony Luck <tony.luck@intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/base/topology.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/base/topology.c b/drivers/base/topology.c
> index 706dbf8bf249..ac6ad9ab67f9 100644
> --- a/drivers/base/topology.c
> +++ b/drivers/base/topology.c
> @@ -155,9 +155,7 @@ static struct attribute *default_attrs[] = {
>  static umode_t topology_is_visible(struct kobject *kobj,
>  				   struct attribute *attr, int unused)
>  {
> -	struct device *dev = kobj_to_dev(kobj);
> -
> -	if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
> +	if (attr == &dev_attr_ppin.attr && !topology_ppin(kobj_to_dev(kobj)->id))
>  		return 0;
>  
>  	return attr->mode;
> -- 
> 2.36.0
> 

Given no comments that this is a bad idea, I'll go apply this now.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] topology: Fix up build warning in topology_is_visible()
  2022-04-23 10:53 ` Greg Kroah-Hartman
@ 2022-04-24 18:08   ` Luck, Tony
  0 siblings, 0 replies; 3+ messages in thread
From: Luck, Tony @ 2022-04-24 18:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel@vger.kernel.org; +Cc: Stephen Rothwell

> Given no comments that this is a bad idea, I'll go apply this now.

FWIW (very little) 0-day didn't find issues with changing from macro to
static inline. But your fix is much neater.

-Tony

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-24 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-22  6:26 [PATCH] topology: Fix up build warning in topology_is_visible() Greg Kroah-Hartman
2022-04-23 10:53 ` Greg Kroah-Hartman
2022-04-24 18:08   ` Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox