]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: cpsw: add missing of_node_put() in cpsw_probe_dt()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 29 Apr 2022 01:53:37 +0000 (09:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Apr 2022 12:37:20 +0000 (13:37 +0100)
'tmp_node' need be put before returning from cpsw_probe_dt(),
so add missing of_node_put() in error path.

Fixes: f5a1d52100ec ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw_new.c

index bd4b1528cf99258d52ea70864d89b411f79e4a36..79e850fe4621c0a9e466f0bb4bb816f267df3658 100644 (file)
@@ -1246,8 +1246,10 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
        data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM,
                                        sizeof(struct cpsw_slave_data),
                                        GFP_KERNEL);
-       if (!data->slave_data)
+       if (!data->slave_data) {
+               of_node_put(tmp_node);
                return -ENOMEM;
+       }
 
        /* Populate all the child nodes here...
         */
@@ -1341,6 +1343,7 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
 
 err_node_put:
        of_node_put(port_np);
+       of_node_put(tmp_node);
        return ret;
 }