clk: visconti: Fix memory leak in visconti_register_pll()
authorXiu Jianfeng <xiujianfeng@huawei.com>
Tue, 22 Nov 2022 15:23:53 +0000 (23:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:19 +0000 (13:32 +0100)
commitf0f1982ddfb418bf7bf05dadebae5c6869a41d41
tree7e120d3b742fbb5027b86de2704e384eeceef78f
parent4fa98de4f8c8f9eb860d05b75e818b070188406d
clk: visconti: Fix memory leak in visconti_register_pll()

[ Upstream commit b55226f8553d255f5002c751c7c6ba9291f34bf2 ]

@pll->rate_table has allocated memory by kmemdup(), if clk_hw_register()
fails, it should be freed, otherwise it will cause memory leak issue,
this patch fixes it.

Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Link: https://lore.kernel.org/r/20221122152353.204132-1-xiujianfeng@huawei.com
Acked-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/visconti/pll.c