path: root/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
diff options
authorArnd Bergmann <arnd@arndb.de>2016-08-02 12:23:29 +0200
committerDavid S. Miller <davem@davemloft.net>2016-08-03 11:52:16 -0700
commitea966cb6b9e11e87f7b146549aef8e13cad5c6ff (patch)
treea64fe820180202189b00ba12af2de1b250eb9bb8 /drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
parentopenvswitch: Remove incorrect WARN_ONCE(). (diff)
net: xgene: fix maybe-uninitialized variable
Building with -Wmaybe-uninitialized shows a potential use of an uninitialized variable: drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: In function 'xgene_enet_phy_connect': drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:802:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized] Although the compiler correctly identified this based on the function, the current code is still safe as long dev->of_node is non-NULL for the case of CONFIG_ACPI=n, which is currently the case. The warning is now disabled by default, but still appears when building with W=1, and other build test tools should be able to detect it as well. Adding an #else clause here makes the code more robust and makes it clear to the compiler that this cannot happen. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 8089a96f601b ("drivers: net: xgene: Add backward compatibility") Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 37a0f463b8de..18bb9556dd00 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -793,6 +793,8 @@ int xgene_enet_phy_connect(struct net_device *ndev)
netdev_err(ndev, "Could not connect to PHY\n");
return -ENODEV;
+ return -ENODEV;