mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 03:38:10 -04:00
net: ethernet: mtk_eth_soc: Use of_get_available_child_by_name()
Use the helper of_get_available_child_by_name() to simplify mtk_mdio_init(). Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
876e52b2d3
commit
1364004b5b
@@ -830,17 +830,12 @@ static int mtk_mdio_init(struct mtk_eth *eth)
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus");
|
||||
mii_np = of_get_available_child_by_name(eth->dev->of_node, "mdio-bus");
|
||||
if (!mii_np) {
|
||||
dev_err(eth->dev, "no %s child node found", "mdio-bus");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!of_device_is_available(mii_np)) {
|
||||
ret = -ENODEV;
|
||||
goto err_put_node;
|
||||
}
|
||||
|
||||
eth->mii_bus = devm_mdiobus_alloc(eth->dev);
|
||||
if (!eth->mii_bus) {
|
||||
ret = -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user