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

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>
This commit is contained in:
Miaoqian Lin 2022-03-08 07:42:47 +00:00 committed by David S. Miller
parent 2169b79258
commit c9ffa3e2bc
1 changed files with 1 additions and 0 deletions

View File

@ -554,6 +554,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);
}