net: dsa: Add missing of_node_put() in dsa_port_link_register_of
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 20 Apr 2022 11:04:08 +0000 (19:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:14:34 +0000 (09:14 +0200)
commit9cc897ca03df52a2fec8632b40d45862fa75d69e
tree0007a4e917689658d1ae388c52a67640a1999600
parent72e7940b00b5a0f8d53747fd6c52a53afddd6728
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>
net/dsa/port.c