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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1438005618-27003-2-git-send-email-govindraj.raja@imgtec.com>
Date:	Mon, 27 Jul 2015 15:00:12 +0100
From:	Govindraj Raja <govindraj.raja@...tec.com>
To:	<linux-kernel@...r.kernel.org>, <linux-mips@...ux-mips.org>,
	"Daniel Lezcano" <daniel.lezcano@...aro.org>,
	<devicetree@...r.kernel.org>
CC:	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Bresticker <abrestic@...omium.org>,
	James Hartley <James.Hartley@...tec.com>,
	"Govindraj Raja" <Govindraj.Raja@...tec.com>,
	Damien Horsley <Damien.Horsley@...tec.com>,
	James Hogan <James.Hogan@...tec.com>,
	Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
	Ezequiel Garcia <ezequiel.garcia@...tec.com>
Subject: [PATCH v4 1/7] clocksource: mips-gic: Enable the clock before using it

From: Ezequiel Garcia <ezequiel.garcia@...tec.com>

For the clock to be used (e.g. get its rate through clk_get_rate)
it should be prepared and enabled first.

Also, while the clock is enabled the driver must hold a reference to it,
so let's remove the call to clk_put.

Reviewed-by: Andrew Bresticker <abrestic@...omium.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@...tec.com>
---
 drivers/clocksource/mips-gic-timer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index b81ed1a..913585d 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -158,8 +158,13 @@ static void __init gic_clocksource_of_init(struct device_node *node)
 
 	clk = of_clk_get(node, 0);
 	if (!IS_ERR(clk)) {
+		if (clk_prepare_enable(clk) < 0) {
+			pr_err("GIC failed to enable clock\n");
+			clk_put(clk);
+			return;
+		}
+
 		gic_frequency = clk_get_rate(clk);
-		clk_put(clk);
 	} else if (of_property_read_u32(node, "clock-frequency",
 					&gic_frequency)) {
 		pr_err("GIC frequency not specified.\n");
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ