Skip to content

Commit

Permalink
net: marvell: prestera: Add missing of_node_put() in prestera_switch_…
Browse files Browse the repository at this point in the history
…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: 501ef30 ("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>
  • Loading branch information
Yuuoniy authored and davem330 committed Mar 9, 2022
1 parent 2169b79 commit c9ffa3e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/marvell/prestera/prestera_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c9ffa3e

Please sign in to comment.