mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
net: dsa: rzn1_a5psw: Use of_get_available_child_by_name()
Simplify a5psw_probe() by using of_get_available_child_by_name(). While at it, move of_node_put(mdio) inside the if block to avoid code duplication. 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:
parent
8d3bbe4355
commit
46df19a8df
@ -1248,18 +1248,16 @@ static int a5psw_probe(struct platform_device *pdev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto clk_disable;
|
goto clk_disable;
|
||||||
|
|
||||||
mdio = of_get_child_by_name(dev->of_node, "mdio");
|
mdio = of_get_available_child_by_name(dev->of_node, "mdio");
|
||||||
if (of_device_is_available(mdio)) {
|
if (mdio) {
|
||||||
ret = a5psw_probe_mdio(a5psw, mdio);
|
ret = a5psw_probe_mdio(a5psw, mdio);
|
||||||
|
of_node_put(mdio);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
of_node_put(mdio);
|
|
||||||
dev_err(dev, "Failed to register MDIO: %d\n", ret);
|
dev_err(dev, "Failed to register MDIO: %d\n", ret);
|
||||||
goto hclk_disable;
|
goto hclk_disable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
of_node_put(mdio);
|
|
||||||
|
|
||||||
ds = &a5psw->ds;
|
ds = &a5psw->ds;
|
||||||
ds->dev = dev;
|
ds->dev = dev;
|
||||||
ds->num_ports = A5PSW_PORTS_NUM;
|
ds->num_ports = A5PSW_PORTS_NUM;
|
||||||
|
Loading…
Reference in New Issue
Block a user