summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-04-29 04:53:37 +0300
committerDavid S. Miller <davem@davemloft.net>2022-04-30 15:37:20 +0300
commit95098d5ac2551769807031444e55a0da5d4f0952 (patch)
treec45769af20db48078cb848a70e253b1148cf5bce /drivers/net
parent1a15267b7be77e0792cf0c7b36ca65c8eb2df0d8 (diff)
downloadlinux-95098d5ac2551769807031444e55a0da5d4f0952.tar.xz
net: cpsw: add missing of_node_put() in cpsw_probe_dt()
'tmp_node' need be put before returning from cpsw_probe_dt(), so add missing of_node_put() in error path. Fixes: ed3525eda4c4 ("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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/ti/cpsw_new.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
index bd4b1528cf99..79e850fe4621 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -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;
}