netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Silence a W=1 compiler warning
@ 2014-06-13 14:12 Bart Van Assche
  2014-06-13 20:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2014-06-13 14:12 UTC (permalink / raw)
  To: David S. Miller; +Cc: Vlad Yasevich, netdev

Avoid that the following compiler warning is reported when building
with W=1:

include/linux/netdevice.h: In function 'netif_addr_lock_nested':
include/linux/netdevice.h:2865:6: warning: variable 'subclass' set but not used [-Wunused-but-set-variable]
  int subclass = SINGLE_DEPTH_NESTING;
      ^

This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Vlad Yasevich <vyasevic@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
---
 include/linux/netdevice.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index abe3de1..3c0a2e7 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2951,12 +2951,10 @@ static inline void netif_addr_lock(struct net_device *dev)
 
 static inline void netif_addr_lock_nested(struct net_device *dev)
 {
-	int subclass = SINGLE_DEPTH_NESTING;
-
-	if (dev->netdev_ops->ndo_get_lock_subclass)
-		subclass = dev->netdev_ops->ndo_get_lock_subclass(dev);
-
-	spin_lock_nested(&dev->addr_list_lock, subclass);
+	spin_lock_nested(&dev->addr_list_lock,
+			 dev->netdev_ops->ndo_get_lock_subclass ?
+			 dev->netdev_ops->ndo_get_lock_subclass(dev) :
+			 SINGLE_DEPTH_NESTING);
 }
 
 static inline void netif_addr_lock_bh(struct net_device *dev)
-- 
1.8.4.5

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

* Re: [PATCH] net: Silence a W=1 compiler warning
  2014-06-13 14:12 [PATCH] net: Silence a W=1 compiler warning Bart Van Assche
@ 2014-06-13 20:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-06-13 20:28 UTC (permalink / raw)
  To: bvanassche; +Cc: vyasevic, netdev

From: Bart Van Assche <bvanassche@acm.org>
Date: Fri, 13 Jun 2014 16:12:49 +0200

> Avoid that the following compiler warning is reported when building
> with W=1:
> 
> include/linux/netdevice.h: In function 'netif_addr_lock_nested':
> include/linux/netdevice.h:2865:6: warning: variable 'subclass' set but not used [-Wunused-but-set-variable]
>   int subclass = SINGLE_DEPTH_NESTING;
>       ^
> 
> This patch does not change any functionality.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

This has already been discussed.

The spin_lock_nested() with your configuration should be adjusted to
mark the argument as used.

There is nothing wrong with this code, it should not warn, it's
simply the spin locking macros that need to be fixed.

I'm not applying this patch, sorry.

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

end of thread, other threads:[~2014-06-13 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 14:12 [PATCH] net: Silence a W=1 compiler warning Bart Van Assche
2014-06-13 20:28 ` David Miller

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