net: bcmgenet: fix phydev reference leak

Make sure to drop the reference taken by of_phy_find_device() when
initialising MOCA PHYs.

Fixes: 6ac9de5f65 ("net: bcmgenet: Register link_update callback for
all MoCA PHYs")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Johan Hovold 2016-11-24 19:21:28 +01:00 committed by David S. Miller
parent fd05d7b18c
commit 0da60541f8
1 changed files with 3 additions and 1 deletions

View File

@ -542,8 +542,10 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
/* Make sure we initialize MoCA PHYs with a link down */
if (phy_mode == PHY_INTERFACE_MODE_MOCA) {
phydev = of_phy_find_device(dn);
if (phydev)
if (phydev) {
phydev->link = 0;
put_device(&phydev->mdio.dev);
}
}
return 0;