public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx•com>
To: Markus Elfring <Markus.Elfring@web•de>,
	Navid Emamdoost <navid.emamdoost@gmail•com>,
	linux-arm-kernel@lists•infradead.org
Cc: kernel-janitors@vger•kernel.org,
	Daniel Lezcano <daniel.lezcano@linaro•org>,
	Kangjie Lu <kjlu@umn•edu>,
	linux-kernel@vger•kernel.org,
	Michal Simek <michal.simek@xilinx•com>,
	Navid Emamdoost <emamd001@umn•edu>,
	Stephen McCamant <smccaman@umn•edu>,
	Thomas Gleixner <tglx@linutronix•de>
Subject: Re: [PATCH] clocksource/drivers: Fix memory leak in ttc_setup_clockevent
Date: Tue, 22 Oct 2019 10:51:11 +0200	[thread overview]
Message-ID: <2a6cdb63-397b-280a-7379-740e8f43ddf6@xilinx.com> (raw)
In-Reply-To: <fb5d5331-9a89-8370-1e61-396dd05f291a@web.de>

On 22. 10. 19 10:26, Markus Elfring wrote:
>> In the impelementation of ttc_setup_clockevent() the allocated memory
>> for ttcce should be released if clk_notifier_register() fails.
> 
> * Please avoid the copying of typos from previous change descriptions.
> 
> * Under which circumstances will an “imperative mood” matter for you here?
>   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=7d194c2100ad2a6dded545887d02754948ca5241#n151
> 
> 
>> +++ b/drivers/clocksource/timer-cadence-ttc.c
>> @@ -424,6 +424,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
>>  				    &ttcce->ttc.clk_rate_change_nb);
>>  	if (err) {
>>  		pr_warn("Unable to register clock notifier.\n");
>> +		kfree(ttcce);
>>  		return err;
>>  	}
> 
> This addition looks correct.
> But I would prefer to move such exception handling code to the end of
> this function implementation so that duplicate source code will be reduced.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=7d194c2100ad2a6dded545887d02754948ca5241#n450

Just a note. Maybe you should also consider to fix this error path in
ttc_setup_clocksource() when notifier also can fail that there is no
need to continue with code execution.

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-10-22  8:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 20:18 [PATCH] clocksource/drivers: Fix memory leak in ttc_setup_clockevent Navid Emamdoost
2019-10-22  8:26 ` Markus Elfring
2019-10-22  8:51   ` Michal Simek [this message]
2019-10-23  4:31     ` [PATCH v2] " Navid Emamdoost
2019-10-23  7:32       ` Michal Simek
2019-10-23  8:00       ` Markus Elfring
2019-10-23  4:47     ` [PATCH] clocksource/drivers: Fix error handling in ttc_setup_clocksource Navid Emamdoost
2019-10-23  7:24       ` Markus Elfring
2019-10-23  8:20       ` Markus Elfring
2019-10-23 10:31       ` Markus Elfring
2019-12-14 22:54       ` Navid Emamdoost
2019-12-16 13:41         ` Daniel Lezcano
2019-12-17 15:09           ` Michal Simek
2019-10-23  4:50     ` [PATCH] clocksource/drivers: Fix memory leak in ttc_setup_clockevent Navid Emamdoost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a6cdb63-397b-280a-7379-740e8f43ddf6@xilinx.com \
    --to=michal.simek@xilinx$(echo .)com \
    --cc=Markus.Elfring@web$(echo .)de \
    --cc=daniel.lezcano@linaro$(echo .)org \
    --cc=emamd001@umn$(echo .)edu \
    --cc=kernel-janitors@vger$(echo .)kernel.org \
    --cc=kjlu@umn$(echo .)edu \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=navid.emamdoost@gmail$(echo .)com \
    --cc=smccaman@umn$(echo .)edu \
    --cc=tglx@linutronix$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox