clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Subsystems (2)
PATCH 1/1 clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc
Free memory and memory mapping, if mxc_timer_init_dt is not successful.
--- drivers/clocksource/timer-imx-gpt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/clocksource/timer-imx-gpt.c +11 -3
@@ -489,12 +489,17 @@ static int __init mxc_timer_init_dt(struct device_node *np, enum imx_gpt_type treturn -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 ;
Signature · 1 line
2.7.4
Quoted 1 line · Arvind Yadav
Subject: clocksource: timer-imx-gpt: Unmap and free region obtained by
of_iomapand 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.
Quoted 1 line
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
I have changed subject as per your review comment.
thanks,
-Arvind
Quoted 25 lines · Thomas Gleixner
Quoted 1 line · Arvind Yadav
Subject: clocksource: timer-imx-gpt: Unmap and free region obtained by
of_iomapand kzallocThese 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
Quoted 1 line · arvind Yadav
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:
Quoted 1 line
Quoted 1 line
clocksrouce/timer-imz-gpt: Prevent resource leaks in error path
Switch on your brain before posting, really!
Thanks,
tglx
Sorry, I will take care.
Thanks,
-Arvind
Quoted 14 lines · Thomas Gleixner
Quoted 1 line · arvind Yadav
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:
Quoted 1 line
Quoted 1 line
clocksrouce/timer-imz-gpt: Prevent resource leaks in error path
Switch on your brain before posting, really!
Thanks,
tglx