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)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 28 Oct 2020 17:51:56 +0000 (18:51 +0100)
commit28d211919e422f58c1e6c900e5810eee4f1ce4c8
tree312fce5d82ce55d6131cd2afec258e9a759267d6
parentba1c30bf3f2536f248d262c6f257b5a787305991
rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

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
drivers/rtc/rtc-sun6i.c