lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1474552200-7749-1-git-send-email-arvind.yadav.cs@gmail.com>
Date:   Thu, 22 Sep 2016 19:20:00 +0530
From:   Arvind Yadav <arvind.yadav.cs@...il.com>
To:     daniel.lezcano@...aro.org, tglx@...utronix.de
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] clocksource: mxs_timer: Unmap region obtained by of_iomap

Free memory mapping, if mxs_timer_init is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ