Hi! > From: Dinghao Liu <dinghao.liu@xxxxxxxxxx> > > [ 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. This still leaks rtc, AFAICT. What is worse, sun6i_rtc will point to invalid memory after the error exit. Something like this? Best regards, Pavel diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index e85abe805606..59389bb99e39 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -211,6 +211,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) rtc->base = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(rtc->base)) { pr_crit("Can't map RTC registers"); + kfree(rtc); goto err; } @@ -272,6 +273,8 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) clk_hw_unregister_fixed_rate(rtc->int_osc); err: kfree(clk_data); + kfree(rtc); + sun6i_rtc = NULL; } CLK_OF_DECLARE_DRIVER(sun6i_rtc_clk, "allwinner,sun6i-a31-rtc", sun6i_rtc_clk_init); -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Attachment:
signature.asc
Description: PGP signature