net: marvell: prestera: Add missing of_node_put() in prestera_switch_set_base_mac_addr

[ Upstream commit c9ffa3e2bc ]

This node pointer is returned by of_find_compatible_node() with
refcount incremented. Calling of_node_put() to aovid the refcount leak.

Fixes: 501ef3066c ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
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-03-08 07:42:47 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель 6e294d3890
Коммит b7c2fd1d12
1 изменённых файлов: 1 добавлений и 0 удалений

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

@ -492,6 +492,7 @@ static int prestera_switch_set_base_mac_addr(struct prestera_switch *sw)
dev_info(prestera_dev(sw), "using random base mac address\n");
}
of_node_put(base_mac_np);
of_node_put(np);
return prestera_hw_switch_mac_set(sw, sw->base_mac);
}