Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 713ad301 authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Greg Kroah-Hartman
Browse files

clk: st: Fix memory leak in st_of_quadfs_setup()



[ Upstream commit cfd3ffb36f0d566846163118651d868e607300ba ]

If st_clk_register_quadfs_pll() fails, @lock should be freed before goto
@err_exit, otherwise will cause meory leak issue, fix it.

Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Link: https://lore.kernel.org/r/20221122133614.184910-1-xiujianfeng@huawei.com


Reviewed-by: default avatarPatrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0ca298d5
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -943,9 +943,10 @@ static void __init st_of_quadfs_setup(struct device_node *np,

	clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, data,
			reg, lock);
	if (IS_ERR(clk))
	if (IS_ERR(clk)) {
		kfree(lock);
		goto err_exit;
	else
	} else
		pr_debug("%s: parent %s rate %u\n",
			__clk_get_name(clk),
			__clk_get_name(clk_get_parent(clk)),