static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
 {
        struct mv643xx_eth_shared_platform_data *pd;
-       struct device_node *pnp, *np = pdev->dev.of_node;
+       struct device_node *np = pdev->dev.of_node;
        int ret;
 
        /* bail out if not registered from DT */
 
        mv643xx_eth_property(np, "tx-checksum-limit", pd->tx_csum_limit);
 
-       for_each_available_child_of_node(np, pnp) {
+       for_each_available_child_of_node_scoped(np, pnp) {
                ret = mv643xx_eth_shared_of_add_port(pdev, pnp);
                if (ret) {
-                       of_node_put(pnp);
                        mv643xx_eth_shared_of_remove();
                        return ret;
                }