mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
net: ftgmac100: Hold reference returned by of_get_child_by_name()
[ Upstream commit49b9f431ff] In ftgmac100_probe(), we should hold the refernece returned by of_get_child_by_name() and use it to call of_node_put() for reference balance. Fixes:39bfab8844("net: ftgmac100: Add support for DT phy-handle property") Signed-off-by: Liang He <windhl@126.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a51040d4b1
commit
29c6a632f8
|
|
@ -1747,6 +1747,19 @@ static int ftgmac100_setup_clk(struct ftgmac100 *priv)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ftgmac100_has_child_node(struct device_node *np, const char *name)
|
||||||
|
{
|
||||||
|
struct device_node *child_np = of_get_child_by_name(np, name);
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
if (child_np) {
|
||||||
|
ret = true;
|
||||||
|
of_node_put(child_np);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int ftgmac100_probe(struct platform_device *pdev)
|
static int ftgmac100_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
|
@ -1860,7 +1873,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
/* Display what we found */
|
/* Display what we found */
|
||||||
phy_attached_info(phy);
|
phy_attached_info(phy);
|
||||||
} else if (np && !of_get_child_by_name(np, "mdio")) {
|
} else if (np && !ftgmac100_has_child_node(np, "mdio")) {
|
||||||
/* Support legacy ASPEED devicetree descriptions that decribe a
|
/* Support legacy ASPEED devicetree descriptions that decribe a
|
||||||
* MAC with an embedded MDIO controller but have no "mdio"
|
* MAC with an embedded MDIO controller but have no "mdio"
|
||||||
* child node. Automatically scan the MDIO bus for available
|
* child node. Automatically scan the MDIO bus for available
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user