diff options
author | Miaoqian Lin <linmq006@gmail.com> | 2022-04-20 14:04:08 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-09 10:05:02 +0300 |
commit | 72ae15d5ce5fd37f3c36fd0a5a3de3cf266c11e8 (patch) | |
tree | 72693be3680baea889877641e9c7fcd039d8679f /net/dsa | |
parent | 14cc2044c17ee5dfab5d975cfb05083ac5414228 (diff) | |
download | linux-72ae15d5ce5fd37f3c36fd0a5a3de3cf266c11e8.tar.xz |
net: dsa: Add missing of_node_put() in dsa_port_link_register_of
[ Upstream commit fc06b2867f4cea543505acfb194c2be4ebf0c7d3 ]
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: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/port.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c index 73569c9af3cc..c9d552c4c358 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -721,8 +721,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; } |