]> git.hungrycats.org Git - linux/commitdiff
net: ethernet: ti: cpsw: fix mdio device reference leak
authorJohan Hovold <johan@kernel.org>
Thu, 17 Nov 2016 16:39:59 +0000 (17:39 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 23 Feb 2017 03:54:37 +0000 (03:54 +0000)
commit 86e1d5adcef961eb383ce4eacbe0ef22f06e2045 upstream.

Make sure to drop the reference taken by of_find_device_by_node() when
looking up an mdio device from a phy_id property during probe.

Fixes: 549985ee9c72 ("cpsw: simplify the setup of the register
pointers")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/ethernet/ti/cpsw.c

index 08d3c20d823456ba033ac4c4f80aeac7670b3287..13e59fdbc6e8a2031821c0f17012a485b4812bae 100644 (file)
@@ -1939,6 +1939,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
                }
                snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
                         PHY_ID_FMT, mdio->name, phyid);
+               put_device(&mdio->dev);
 
                mac_addr = of_get_mac_address(slave_node);
                if (mac_addr)