linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: mxs_timer: Unmap region obtained by of_iomap
@ 2016-09-22 13:50 Arvind Yadav
  0 siblings, 0 replies; only message in thread
From: Arvind Yadav @ 2016-09-22 13:50 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel

Free memory mapping, if mxs_timer_init is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/clocksource/mxs_timer.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/mxs_timer.c b/drivers/clocksource/mxs_timer.c
index 0ba0a91..add3c9c0 100644
--- a/drivers/clocksource/mxs_timer.c
+++ b/drivers/clocksource/mxs_timer.c
@@ -235,12 +235,13 @@ static int __init mxs_timer_init(struct device_node *np)
 	timer_clk = of_clk_get(np, 0);
 	if (IS_ERR(timer_clk)) {
 		pr_err("%s: failed to get clk\n", __func__);
+		iounmap(mxs_timrot_base);
 		return PTR_ERR(timer_clk);
 	}
 
 	ret = clk_prepare_enable(timer_clk);
 	if (ret)
-		return ret;
+		goto error_iounmap;
 
 	/*
 	 * Initialize timers to a known state
@@ -280,17 +281,24 @@ static int __init mxs_timer_init(struct device_node *np)
 	/* init and register the timer to the framework */
 	ret = mxs_clocksource_init(timer_clk);
 	if (ret)
-		return ret;
+		goto error_iounmap;
 
 	ret = mxs_clockevent_init(timer_clk);
 	if (ret)
-		return ret;
+		goto error_iounmap;
 
 	/* Make irqs happen */
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq <= 0)
-		return -EINVAL;
+	if (irq <= 0) {
+		ret = -EINVAL;
+		goto error_iounmap;
+	}
 
 	return setup_irq(irq, &mxs_timer_irq);
+
+error_iounmap:
+	iounmap(mxs_timrot_base);
+	return ret;
+
 }
 CLOCKSOURCE_OF_DECLARE(mxs, "fsl,timrot", mxs_timer_init);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-22 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 13:50 [PATCH] clocksource: mxs_timer: Unmap region obtained by of_iomap Arvind Yadav

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).