diff options
author | Johan Hovold <johan@kernel.org> | 2016-11-24 21:21:27 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-28 04:01:15 +0300 |
commit | fd05d7b18cec1af043990c4b3aabc6780575375c (patch) | |
tree | b7820844a9aac567f12a48550b3cd3639075030b /net/dsa | |
parent | c9bd28233b6d0d82ac3ba0215723be0a8262c39c (diff) | |
download | linux-fd05d7b18cec1af043990c4b3aabc6780575375c.tar.xz |
net: dsa: fix fixed-link-phy device leaks
Make sure to drop the reference taken by of_phy_find_device() when
registering and deregistering the fixed-link PHY-device.
Fixes: 39b0c705195e ("net: dsa: Allow configuration of CPU & DSA port
speeds/duplex")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index a6902c1e2f28..cb0091b99592 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -233,6 +233,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev, genphy_read_status(phydev); if (ds->ops->adjust_link) ds->ops->adjust_link(ds, port, phydev); + + put_device(&phydev->mdio.dev); } return 0; @@ -509,8 +511,9 @@ void dsa_cpu_dsa_destroy(struct device_node *port_dn) if (of_phy_is_fixed_link(port_dn)) { phydev = of_phy_find_device(port_dn); if (phydev) { - phy_device_free(phydev); fixed_phy_unregister(phydev); + put_device(&phydev->mdio.dev); + phy_device_free(phydev); } } } |