Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1488911
| From | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] clocksource: timer-imx-gpt: Unmap and free region obtained by of_iomap and kzalloc |
| Date | 2016-09-22 16:10 +0200 |
| Message-ID | <skcRj-7nx-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[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
csiph-web