net: dsa: Add missing of_node_put() in dsa_port_link_register_of

[ Upstream commit fc06b2867f ]

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: a20f997010 ("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>
This commit is contained in:
Miaoqian Lin 2022-04-20 19:04:08 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель 72e7940b00
Коммит 9cc897ca03
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -1201,8 +1201,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;
}