Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488911 > unrolled thread

[PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2016-09-22 16:10 +0200
Last post2016-09-22 16:50 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc Arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-09-22 16:10 +0200
    Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained  by of_iomap and kzalloc Thomas Gleixner <tglx@linutronix.de> - 2016-09-22 16:20 +0200
      Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region  obtained by of_iomap and kzalloc arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-09-22 16:30 +0200
        Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained  by of_iomap and kzalloc Thomas Gleixner <tglx@linutronix.de> - 2016-09-22 16:40 +0200
          Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region  obtained by of_iomap and kzalloc arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-09-22 16:50 +0200

#1488911 — [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2016-09-22 16:10 +0200
Subject[PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Message-ID<skcRj-7nx-1@gated-at.bofh.it>
Free memory and memory mapping, if mxc_timer_init_dt is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/clocksource/timer-imx-gpt.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index f595460..19f6860 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -489,12 +489,17 @@ static int __init mxc_timer_init_dt(struct device_node *np,  enum imx_gpt_type t
 		return -ENOMEM;
 
 	imxtm->base = of_iomap(np, 0);
-	if (!imxtm->base)
+	if (!imxtm->base) {
+		kfree(imxtm);
 		return -ENXIO;
+	}
 
 	imxtm->irq = irq_of_parse_and_map(np, 0);
-	if (imxtm->irq <= 0)
+	if (imxtm->irq <= 0) {
+		iounmap(imxtm->base);
+		kfree(imxtm);
 		return -EINVAL;
+	}
 
 	imxtm->clk_ipg = of_clk_get_by_name(np, "ipg");
 
@@ -506,8 +511,11 @@ static int __init mxc_timer_init_dt(struct device_node *np,  enum imx_gpt_type t
 	imxtm->type = type;
 
 	ret = _mxc_timer_init(imxtm);
-	if (ret)
+	if (ret) {
+		iounmap(imxtm->base);
+		kfree(imxtm);
 		return ret;
+	}
 
 	initialized = 1;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1488926 — Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

FromThomas Gleixner <tglx@linutronix.de>
Date2016-09-22 16:20 +0200
SubjectRe: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Message-ID<skd0Z-7t0-5@gated-at.bofh.it>
In reply to#1488911
On Thu, 22 Sep 2016, Arvind Yadav wrote:

> Subject: clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

These subject lines are useless and way too long. A patch subject should
describe the nature of the patch and not elaborate what the patch is doing
technically.

   clocksrouce/timer-imz-gpt: Prevent resource leaks in error path

would be a proper subject line which makes it entirely clear what this
patch is about.

From your subject line I have to read the patch itself to figure that
out. It's completely irrelevant whether that resource is a mapping or
allocated memory. The point is that the error path leaks resource(s).

See Documentation/SubmittingPatches. There you'll find a lengthy
explanation about changelogs and summary lines in particular.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1488933 — Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

Fromarvind Yadav <arvind.yadav.cs@gmail.com>
Date2016-09-22 16:30 +0200
SubjectRe: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Message-ID<skdaF-7wd-15@gated-at.bofh.it>
In reply to#1488926
I have changed  subject as per your review comment.

thanks,

     -Arvind


On Thursday 22 September 2016 07:46 PM, Thomas Gleixner wrote:
> On Thu, 22 Sep 2016, Arvind Yadav wrote:
>
>> Subject: clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
> These subject lines are useless and way too long. A patch subject should
> describe the nature of the patch and not elaborate what the patch is doing
> technically.
>
>     clocksrouce/timer-imz-gpt: Prevent resource leaks in error path
>
> would be a proper subject line which makes it entirely clear what this
> patch is about.
>
>  From your subject line I have to read the patch itself to figure that
> out. It's completely irrelevant whether that resource is a mapping or
> allocated memory. The point is that the error path leaks resource(s).
>
> See Documentation/SubmittingPatches. There you'll find a lengthy
> explanation about changelogs and summary lines in particular.
>
> Thanks,
>
> 	tglx
>
>
>

[toc] | [prev] | [next] | [standalone]


#1488940 — Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

FromThomas Gleixner <tglx@linutronix.de>
Date2016-09-22 16:40 +0200
SubjectRe: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Message-ID<skdkl-7zs-13@gated-at.bofh.it>
In reply to#1488933
On Thu, 22 Sep 2016, arvind Yadav wrote:

> I have changed  subject as per your review comment.

I certainly need a reminder that you did this. NOT!
 
And you nicely copied and pasted the typo which I put into that line on
purpose:

> >     clocksrouce/timer-imz-gpt: Prevent resource leaks in error path

Switch on your brain before posting, really!

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1488944 — Re: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc

Fromarvind Yadav <arvind.yadav.cs@gmail.com>
Date2016-09-22 16:50 +0200
SubjectRe: [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Message-ID<skdu1-7CL-3@gated-at.bofh.it>
In reply to#1488940
Sorry, I will take care.

Thanks,
     -Arvind

On Thursday 22 September 2016 08:06 PM, Thomas Gleixner wrote:
> On Thu, 22 Sep 2016, arvind Yadav wrote:
>
>> I have changed  subject as per your review comment.
> I certainly need a reminder that you did this. NOT!
>   
> And you nicely copied and pasted the typo which I put into that line on
> purpose:
>
>>>      clocksrouce/timer-imz-gpt: Prevent resource leaks in error path
> Switch on your brain before posting, really!
>
> Thanks,
>
> 	tglx

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web