MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu
authorZhang Qilong <zhangqilong3@huawei.com>
Fri, 13 Nov 2020 13:18:56 +0000 (21:18 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:05:49 +0000 (13:05 +0100)
commitfdf22edef4608e2526056f08c398931a8037a56c
tree04ad9c5ec788ec0e39191e9c7e385cab7a70ea7d
parent0f0b9164ed6ae922ff8d5cc433b502db287f66e9
MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu

[ Upstream commit ac3b57adf87ad9bac7e33ca26bbbb13fae1ed62b ]

If the clk_register fails, we should free h before
function returns to prevent memleak.

Fixes: 474402291a0ad ("MIPS: Alchemy: clock framework integration of onchip clocks")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/alchemy/common/clock.c