Skip to content

Commit

Permalink
soc: rockchip: Fix refcount leak in rockchip_grf_init
Browse files Browse the repository at this point in the history
[ Upstream commit 9b59588 ]

of_find_matching_node_and_match returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 4c58063 ("soc: rockchip: add driver handling grf setup")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220516072013.19731-1-linmq006@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yuuoniy authored and gregkh committed Jun 14, 2022
1 parent cfe8a09 commit 5b3e990
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/soc/rockchip/grf.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ static int __init rockchip_grf_init(void)
return -ENODEV;
if (!match || !match->data) {
pr_err("%s: missing grf data\n", __func__);
of_node_put(np);
return -EINVAL;
}

grf_info = match->data;

grf = syscon_node_to_regmap(np);
of_node_put(np);
if (IS_ERR(grf)) {
pr_err("%s: could not get grf syscon\n", __func__);
return PTR_ERR(grf);
Expand Down

0 comments on commit 5b3e990

Please sign in to comment.