Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357696

Re: [PATCH] smc91x: avoid self-comparison warning

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] smc91x: avoid self-comparison warning
Date 2016-03-15 00:40 +0100
Message-ID <rcKfD-2br-9@gated-at.bofh.it> (permalink)
References <rcJth-1DY-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Arnd Bergmann <arnd@arndb.de>
Date: Mon, 14 Mar 2016 23:45:12 +0100

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

Applied, thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] smc91x: avoid self-comparison warning Arnd Bergmann <arnd@arndb.de> - 2016-03-14 23:50 +0100
  Re: [PATCH] smc91x: avoid self-comparison warning David Miller <davem@davemloft.net> - 2016-03-15 00:40 +0100

csiph-web