smc91x: avoid self-comparison warning
authorArnd Bergmann <arnd@arndb.de>
Mon, 14 Mar 2016 22:45:12 +0000 (23:45 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2016 23:37:03 +0000 (19:37 -0400)
The smc91x driver defines a macro that compares its argument to
itself, apparently to get a true result while using its argument
to avoid a warning about unused local variables.

Unfortunately, this triggers a warning with gcc-6, as the comparison
is obviously useless:

drivers/net/ethernet/smsc/smc91x.c: In function 'smc_hardware_send_pkt':
drivers/net/ethernet/smsc/smc91x.c:563:14: error: self-comparison always evaluates to true [-Werror=tautological-compare]
  if (!smc_special_trylock(&lp->lock, flags)) {

This replaces the macro with another one that behaves similarly,
with a cast to (void) to ensure the argument is used, and using
a literal 'true' as its value.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/smsc/smc91x.c

index db7db8ac4ca308a2f5f52e11f052bbd246c824a4..c5ed27c54724a9a118f46f4316ad96ae71dc5a7c 100644 (file)
@@ -540,7 +540,7 @@ static inline void  smc_rcv(struct net_device *dev)
 #define smc_special_lock(lock, flags)          spin_lock_irqsave(lock, flags)
 #define smc_special_unlock(lock, flags)        spin_unlock_irqrestore(lock, flags)
 #else
-#define smc_special_trylock(lock, flags)       (flags == flags)
+#define smc_special_trylock(lock, flags)       ((void)flags, true)
 #define smc_special_lock(lock, flags)          do { flags = 0; } while (0)
 #define smc_special_unlock(lock, flags)        do { flags = 0; } while (0)
 #endif
This page took 0.028461 seconds and 5 git commands to generate.