Skip to content

Commit

Permalink
net: dsa: Add missing of_node_put() in dsa_port_link_register_of
Browse files Browse the repository at this point in the history
The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.
of_node_put() will check for NULL value.

Fixes: a20f997 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed")
Signed-off-by: Miaoqian Lin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Yuuoniy authored and davem330 committed Apr 22, 2022
1 parent d48fea8 commit fc06b28
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/dsa/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,10 @@ int dsa_port_link_register_of(struct dsa_port *dp)
if (ds->ops->phylink_mac_link_down)
ds->ops->phylink_mac_link_down(ds, port,
MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
of_node_put(phy_np);
return dsa_port_phylink_register(dp);
}
of_node_put(phy_np);
return 0;
}

Expand Down

0 comments on commit fc06b28

Please sign in to comment.