From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: daniel.lezcano@linaro.org, tglx@linutronix.de
Cc: viresh.kumar@linaro.org, jason@lakedaemon.net,
linux-kernel@vger.kernel.org
Subject: [PATCH] clocksource: time-orion: Unmap region obtained by of_iomap
Date: Wed, 21 Sep 2016 21:16:42 +0530 [thread overview]
Message-ID: <1474472802-8286-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)
Free memory mapping, if orion_timer_init is not successful.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/clocksource/time-orion.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c
index a28f496..789070d 100644
--- a/drivers/clocksource/time-orion.c
+++ b/drivers/clocksource/time-orion.c
@@ -119,20 +119,22 @@ static int __init orion_timer_init(struct device_node *np)
clk = of_clk_get(np, 0);
if (IS_ERR(clk)) {
pr_err("%s: unable to get clk\n", np->name);
+ iounmap(timer_base);
return PTR_ERR(clk);
}
ret = clk_prepare_enable(clk);
if (ret) {
pr_err("Failed to prepare clock");
- return ret;
+ goto err_iounmap;
}
/* we are only interested in timer1 irq */
irq = irq_of_parse_and_map(np, 1);
if (irq <= 0) {
pr_err("%s: unable to parse timer1 irq\n", np->name);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_iounmap;
}
/* setup timer0 as free-running clocksource */
@@ -147,7 +149,7 @@ static int __init orion_timer_init(struct device_node *np)
clocksource_mmio_readl_down);
if (ret) {
pr_err("Failed to initialize mmio timer");
- return ret;
+ goto err_iounmap;
}
sched_clock_register(orion_read_sched_clock, 32, clk_get_rate(clk));
@@ -156,7 +158,7 @@ static int __init orion_timer_init(struct device_node *np)
ret = setup_irq(irq, &orion_clkevt_irq);
if (ret) {
pr_err("%s: unable to setup irq\n", np->name);
- return ret;
+ goto err_iounmap;
}
ticks_per_jiffy = (clk_get_rate(clk) + HZ/2) / HZ;
@@ -166,5 +168,10 @@ static int __init orion_timer_init(struct device_node *np)
ORION_ONESHOT_MIN, ORION_ONESHOT_MAX);
return 0;
+
+err_iounmap:
+ iounmap(timer_base);
+ return ret;
+
}
CLOCKSOURCE_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init);
--
2.7.4
reply other threads:[~2016-09-21 15:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1474472802-8286-1-git-send-email-arvind.yadav.cs@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).