Commit 95098d5a authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller

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: ed3525ed ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1a15267b
...@@ -1246,8 +1246,10 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw) ...@@ -1246,8 +1246,10 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM, data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM,
sizeof(struct cpsw_slave_data), sizeof(struct cpsw_slave_data),
GFP_KERNEL); GFP_KERNEL);
if (!data->slave_data) if (!data->slave_data) {
of_node_put(tmp_node);
return -ENOMEM; return -ENOMEM;
}
/* Populate all the child nodes here... /* Populate all the child nodes here...
*/ */
...@@ -1341,6 +1343,7 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw) ...@@ -1341,6 +1343,7 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
err_node_put: err_node_put:
of_node_put(port_np); of_node_put(port_np);
of_node_put(tmp_node);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment