static int bcmasp_probe(struct platform_device *pdev)
 {
-       struct device_node *ports_node, *intf_node;
        const struct bcmasp_plat_data *pdata;
        struct device *dev = &pdev->dev;
+       struct device_node *ports_node;
        struct bcmasp_priv *priv;
        struct bcmasp_intf *intf;
        int ret = 0, count = 0;
        }
 
        i = 0;
-       for_each_available_child_of_node(ports_node, intf_node) {
+       for_each_available_child_of_node_scoped(ports_node, intf_node) {
                intf = bcmasp_interface_create(priv, intf_node, i);
                if (!intf) {
                        dev_err(dev, "Cannot create eth interface %d\n", i);
                        bcmasp_remove_intfs(priv);
-                       of_node_put(intf_node);
                        ret = -ENOMEM;
                        goto of_put_exit;
                }