diff options
author | Xiu Jianfeng <xiujianfeng@huawei.com> | 2022-11-22 16:36:14 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-14 12:16:19 +0300 |
commit | efd025f32fce27a8ada9bcb4731e8a84476e5b3d (patch) | |
tree | 47ad0bd9ba8e19c8acc80b2f3a5033e73c9332a4 /drivers/clk | |
parent | 1c6447d0fc68650e51586dde79b5090d9d77f13a (diff) | |
download | linux-efd025f32fce27a8ada9bcb4731e8a84476e5b3d.tar.xz |
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: Xiu Jianfeng <xiujianfeng@huawei.com>
Link: https://lore.kernel.org/r/20221122133614.184910-1-xiujianfeng@huawei.com
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/st/clkgen-fsyn.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index f1adc858b590..0e58a7cda427 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -942,9 +942,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)), |