Skip to content

Commit

Permalink
net: bcm63xx: avoid referencing uninitialized variable
Browse files Browse the repository at this point in the history
gcc found a reference to an uninitialized variable in the error handling
of bcm_enet_open, introduced by a recent cleanup:

drivers/net/ethernet/broadcom/bcm63xx_enet.c: In function 'bcm_enet_open'
drivers/net/ethernet/broadcom/bcm63xx_enet.c:1129:2: warning: 'phydev' may be used uninitialized in this function [-Wmaybe-uninitialized]

This makes the use of that variable conditional, so we only reference it
here after it has been used before. Unlike my normal patches, I have not
build-tested this one, as I don't currently have mips test in my
randconfig setup.

Fixes: 625eb86 ("net: ethernet: broadcom: bcm63xx: use phydev from struct net_device")
Cc: Philippe Reynes <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
arndb authored and davem330 committed Oct 18, 2016
1 parent 41ee9c5 commit 4b75ca5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/broadcom/bcm63xx_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,8 @@ static int bcm_enet_open(struct net_device *dev)
free_irq(dev->irq, dev);

out_phy_disconnect:
phy_disconnect(phydev);
if (priv->has_phy)
phy_disconnect(phydev);

return ret;
}
Expand Down

0 comments on commit 4b75ca5

Please sign in to comment.