net: marvell: prestera: Add missing of_node_put() in prestera_switch_set_base_mac_addr
authorMiaoqian Lin <linmq006@gmail.com>
Tue, 8 Mar 2022 07:42:47 +0000 (07:42 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Mar 2022 13:23:38 +0000 (14:23 +0100)
[ Upstream commit c9ffa3e2bc451816ce0295e40063514fabf2bd36 ]

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

Fixes: 501ef3066c89 ("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>
drivers/net/ethernet/marvell/prestera/prestera_main.c

index aa543b29799ed29453b7f129c99013be2d3a3bfa..656c68cfd7ec652213d633b5e556fc3dfbff0684 100644 (file)
@@ -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);
 }