]> git.baikalelectronics.ru Git - kernel.git/commitdiff
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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Mar 2022 12:16:32 +0000 (12:16 +0000)
This node pointer is returned by of_find_compatible_node() with
refcount incremented. Calling of_node_put() to aovid the refcount leak.

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

index cad93f747d0cc69df5165bd5379226f41ccf569f..73cd0a4b729142dd8738f4f7403dbe6ca4c75172 100644 (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);
 }