Thread (4 messages) 4 messages, 2 authors, 2011-10-26

[PATCH] arm/tegra: clk_get should not be fatal

From: Peter De Schrijver <hidden>
Date: 2011-10-25 17:00:59
Also in: linux-tegra, lkml

On Tue, Oct 25, 2011 at 06:26:08PM +0200, Joe Perches wrote:
On Tue, 2011-10-25 at 19:15 +0300, pdeschrijver at nvidia.com wrote:
quoted
The timer and rtc-timer clocks aren't gated by default, so there is no reason
to crash the system if the dummy enable call failed.
[]
quoted
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
[]
quoted
@@ -186,16 +186,20 @@ static void __init tegra_init_timer(void)
 	int ret;
 
 	clk = clk_get_sys("timer", NULL);
-	BUG_ON(IS_ERR(clk));
-	clk_enable(clk);
+	if (IS_ERR(clk))
+		pr_warning("Unable to get timer clock");
+	else
+		clk_enable(clk);
 
 	/*
 	 * rtc registers are used by read_persistent_clock, keep the rtc clock
 	 * enabled
 	 */
 	clk = clk_get_sys("rtc-tegra", NULL);
-	BUG_ON(IS_ERR(clk));
-	clk_enable(clk);
+	if (IS_ERR(clk))
+		pr_warning("Unable to get rtc-tegra clock");
+	else
+		clk_enable(clk);
Are these messages are really necessary?
I think it's still useful to have them as not having a clock fw is a strange
situation. It's not fatal though, but worth a warning I would say.
Maybe just:
	if (!IS_ERR(clk))
		clk_enable(clk)

If these are really necessary, please use
	pr_warn("Unable to get <foo>\n");
pr_warn and with a terminating newline.
Is pr_warn any different then pr_warning? Point taken about the newline.

Cheers,

Peter.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help