rtc: sun6i: Fix memleak in sun6i_rtc_clk_init
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Tue, 20 Oct 2020 06:12:26 +0000 (14:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Jan 2021 13:56:53 +0000 (14:56 +0100)
commit0ad9a6e6139dabe347ce6c259765667069b6e11f
tree69754602208a69bff1481803ec597b5b6d93b345
parentb5a2f093b6b16db004619d6403f68c75ee85d794
rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

[ Upstream commit 28d211919e422f58c1e6c900e5810eee4f1ce4c8 ]

When clk_hw_register_fixed_rate_with_accuracy() fails,
clk_data should be freed. It's the same for the subsequent
two error paths, but we should also unregister the already
registered clocks in them.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201020061226.6572-1-dinghao.liu@zju.edu.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-sun6i.c