soc: rockchip: Fix refcount leak in rockchip_grf_init
[ Upstream commit 9b59588d8be91c96bfb0371e912ceb4f16315dbf ]
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: 4c58063d42
("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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
cfe8a0967d
commit
5b3e990f85
@@ -148,12 +148,14 @@ static int __init rockchip_grf_init(void)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (!match || !match->data) {
|
if (!match || !match->data) {
|
||||||
pr_err("%s: missing grf data\n", __func__);
|
pr_err("%s: missing grf data\n", __func__);
|
||||||
|
of_node_put(np);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
grf_info = match->data;
|
grf_info = match->data;
|
||||||
|
|
||||||
grf = syscon_node_to_regmap(np);
|
grf = syscon_node_to_regmap(np);
|
||||||
|
of_node_put(np);
|
||||||
if (IS_ERR(grf)) {
|
if (IS_ERR(grf)) {
|
||||||
pr_err("%s: could not get grf syscon\n", __func__);
|
pr_err("%s: could not get grf syscon\n", __func__);
|
||||||
return PTR_ERR(grf);
|
return PTR_ERR(grf);
|
||||||
|
Reference in New Issue
Block a user