Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751895AbbEZSoy (ORCPT ); Tue, 26 May 2015 14:44:54 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:20477 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbbEZSow (ORCPT ); Tue, 26 May 2015 14:44:52 -0400 From: Ezequiel Garcia To: , , "Daniel Lezcano" , CC: Thomas Gleixner , Andrew Bresticker , James Hartley , , , James Hogan , Ezequiel Garcia Subject: [PATCH v2 1/7] clocksource: mips-gic: Enable the clock before using it Date: Tue, 26 May 2015 15:39:02 -0300 Message-ID: <1432665548-16024-2-git-send-email-ezequiel.garcia@imgtec.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1432665548-16024-1-git-send-email-ezequiel.garcia@imgtec.com> References: <1432665548-16024-1-git-send-email-ezequiel.garcia@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.100.200.175] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1344 Lines: 39 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 Signed-off-by: Ezequiel Garcia --- 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"); -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/