]> git.baikalelectronics.ru Git - kernel.git/commit
net/xgene: fix error handling during reset
authorArnd Bergmann <arnd@arndb.de>
Fri, 26 Aug 2016 15:25:46 +0000 (17:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Aug 2016 04:29:46 +0000 (00:29 -0400)
commit3478c8fc9cef230528c69858ace3632d42a2adef
tree383547a7ec0f4c697b560821a2e4c23fbb0e409b
parentf65a53313d99865549b0c86e21999a62d5afffe4
net/xgene: fix error handling during reset

The newly added reset logic uses helper functions for the MMIO that
may fail. However, when the read operation fails, we end up writing
back uninitialized data to the register, as gcc warns:

drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c: In function 'xgene_enet_link_state':
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c:213:2: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c:209:6: note: 'data' was declared here
  u32 data;

We already print a warning to the console log if that happens,
the best alternative that I can see is skip the rest of the reset
sequence if the register value cannot be read: Most likely the
write would fail as well, and if it succeeded, worse things could
happen.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 8a08d00f87d6 ("drivers: net: xgene: XFI PCS reset when link is down")
Cc: Fushen Chen <fchen@apm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c