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)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2016 18:48:52 +0000 (13:48 -0500)
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>
drivers/net/ethernet/ti/cpsw.c

index f60f8ab7c1e329510c6669c926c7d0411d452412..84c5d214557ec88f6e31b8283cd123ee76b7c3ea 100644 (file)
@@ -2397,6 +2397,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);
                } else {
                        dev_err(&pdev->dev,
                                "No slave[%d] phy_id, phy-handle, or fixed-link property\n",