[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1397728407-13909-3-git-send-email-geert+renesas@glider.be>
Date: Thu, 17 Apr 2014 11:53:27 +0200
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH 3/3] cpufreq: ppc: Fix handling of non-existent clocks
If the clock doesn't exist, clk_get_rate() returns -EINVAL, which becomes
a large number (freq is u32), failing the "freq < min_cpufreq" test.
Explicitly test for "(u32)-EINVAL" to fix this.
Update the comment, and fix a grammer issue while we're at it.
Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
drivers/cpufreq/ppc-corenet-cpufreq.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
index 53881d78a931..7027eab814ce 100644
--- a/drivers/cpufreq/ppc-corenet-cpufreq.c
+++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
@@ -179,10 +179,11 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
clk = of_clk_get(data->parent, i);
freq = clk_get_rate(clk);
/*
- * the clock is valid if its frequency is not masked
- * and large than minimum allowed frequency.
+ * the clock is valid if it exists, its frequency is not
+ * masked, and larger than minimum allowed frequency.
*/
- if (freq < min_cpufreq || (mask & (1 << i)))
+ if (freq == (u32)-EINVAL || freq < min_cpufreq ||
+ (mask & (1 << i)))
table[i].frequency = CPUFREQ_ENTRY_INVALID;
else
table[i].frequency = freq / 1000;
--
1.7.9.5
--
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