Re: [PATCH] clocksource/drivers: Fix something in ttc_setup_clockevent and ttc_setup_clocksource

From: Markus Elfring
Date: Mon Dec 23 2019 - 07:44:13 EST


> In the implementation of ttc_setup_clockevent() and
> ttc_setup_clocksource(), the allocated memory for ttccs is leaked when
> clk_notifier_register() fails.

I suggest to correct your commit message.


> Use goto to direct the execution into error handling path.

* Should the desired completion of the exception handling be described
by an other wording?

* Will it be better to improve the affected functions by
separate update steps?

* How do you think about to add the tag âReported-byâ for Michal Simek?
https://lore.kernel.org/linux-arm-kernel/2a6cdb63-397b-280a-7379-740e8f43ddf6@xxxxxxxxxx/


â
> +++ b/drivers/clocksource/timer-cadence-ttc.c
â
> @@ -363,16 +363,20 @@ static int __init ttc_setup_clocksource(struct clk *clk, void __iomem *base,
â
> return 0;
> +
> +release_ttcce:
> +
> + kfree(ttcce);
> + return err;
â

* Please omit a blank line after the label.

* Is there a need to call the function âclk_disable_unprepareâ
by another jump target?

Regards,
Markus