clk: rockchip: Fix memory leak in rockchip_clk_register_pll()
authorXiu Jianfeng <xiujianfeng@huawei.com>
Wed, 23 Nov 2022 09:12:01 +0000 (17:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:11 +0000 (13:14 +0100)
commit5b0a1f1247cd42ac5e0d369f8dbb58762692edee
tree1427c92a888127b42231fb78d52e799429d0cbc7
parent27aac5c012462e6095997c127461b4d460c90c5f
clk: rockchip: Fix memory leak in rockchip_clk_register_pll()

[ Upstream commit 739a6a6bbdb793bd57938cb24aa5a6df89983546 ]

If clk_register() fails, @pll->rate_table may have allocated memory by
kmemdup(), so it needs to be freed, otherwise will cause memory leak
issue, this patch fixes it.

Fixes: 90c590254051 ("clk: rockchip: add clock type for pll clocks and pll used on rk3066")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Link: https://lore.kernel.org/r/20221123091201.199819-1-xiujianfeng@huawei.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/rockchip/clk-pll.c