]> git.baikalelectronics.ru Git - kernel.git/commit
net: xgene: avoid bogus maybe-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Thu, 8 Dec 2016 21:57:05 +0000 (22:57 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Dec 2016 02:30:54 +0000 (21:30 -0500)
commit0f77606575d483b9881fca10febab21ef65cbaa8
tree6cf146ac98bcde1e952430951046a9186227c6db
parentea9d47ec1245aa86c38f7a7478174118831df19a
net: xgene: avoid bogus maybe-uninitialized warning

In some configurations, gcc cannot trace the state of variables
across a spin_unlock() barrier, leading to a warning about
correct code:

xgene_enet_main.c: In function 'xgene_enet_start_xmit':
../../../phy/mdio-xgene.h:112:14: error: 'mss_index' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Here we can trivially move the assignment before that spin_unlock,
which reliably avoids the warning.

Fixes: 446a930b05c7 ("drivers: net: xgene: Fix MSS programming")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/apm/xgene/xgene_enet_main.c