Skip to content

Commit a7b3274

Browse files
javiercarrascocruzdavem330
authored andcommitted
net: mvpp2: use device_for_each_child_node() to access device child nodes
The iterated nodes are direct children of the device node, and the `device_for_each_child_node()` macro accounts for child node availability. `fwnode_for_each_available_child_node()` is meant to access the child nodes of an fwnode, and therefore not direct child nodes of the device node. The child nodes within mvpp2_probe are not accessed outside the loops, and the scoped version of the macro can be used to automatically decrement the refcount on early exits. Use `device_for_each_child_node()` and its scoped variant to indicate device's direct child nodes. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e81d00a commit a7b3274

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7417,8 +7417,6 @@ static int mvpp2_get_sram(struct platform_device *pdev,
74177417

74187418
static int mvpp2_probe(struct platform_device *pdev)
74197419
{
7420-
struct fwnode_handle *fwnode = pdev->dev.fwnode;
7421-
struct fwnode_handle *port_fwnode;
74227420
struct mvpp2 *priv;
74237421
struct resource *res;
74247422
void __iomem *base;
@@ -7591,7 +7589,7 @@ static int mvpp2_probe(struct platform_device *pdev)
75917589
}
75927590

75937591
/* Map DTS-active ports. Should be done before FIFO mvpp2_init */
7594-
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
7592+
device_for_each_child_node_scoped(&pdev->dev, port_fwnode) {
75957593
if (!fwnode_property_read_u32(port_fwnode, "port-id", &i))
75967594
priv->port_map |= BIT(i);
75977595
}
@@ -7614,7 +7612,7 @@ static int mvpp2_probe(struct platform_device *pdev)
76147612
goto err_axi_clk;
76157613

76167614
/* Initialize ports */
7617-
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
7615+
device_for_each_child_node_scoped(&pdev->dev, port_fwnode) {
76187616
err = mvpp2_port_probe(pdev, port_fwnode, priv);
76197617
if (err < 0)
76207618
goto err_port_probe;
@@ -7653,8 +7651,6 @@ static int mvpp2_probe(struct platform_device *pdev)
76537651
return 0;
76547652

76557653
err_port_probe:
7656-
fwnode_handle_put(port_fwnode);
7657-
76587654
for (i = 0; i < priv->port_count; i++)
76597655
mvpp2_port_remove(priv->port_list[i]);
76607656
err_axi_clk:

0 commit comments

Comments
 (0)