Skip to content

Commit

Permalink
net: cpsw: add missing of_node_put() in cpsw_probe_dt()
Browse files Browse the repository at this point in the history
'tmp_node' need be put before returning from cpsw_probe_dt(),
so add missing of_node_put() in error path.

Fixes: ed3525e ("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>
  • Loading branch information
Yang Yingliang authored and David S. Miller committed Apr 30, 2022
1 parent 1a15267 commit 95098d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/ti/cpsw_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -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...
*/
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 95098d5

Please sign in to comment.