diff mbox

ARM: tegra30: clk: Fix output_rate overflow

Message ID 1350376309-24557-1-git-send-email-markz@nvidia.com
State Accepted, archived
Headers show

Commit Message

Mark Zhang Oct. 16, 2012, 8:31 a.m. UTC
Change the type of variable from "unsigned long" to "u64".
This avoids the overflow while clock rate calculating.

Signed-off-by: Mark Zhang <markz@nvidia.com>
---
 arch/arm/mach-tegra/tegra30_clocks.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Warren Oct. 16, 2012, 5:29 p.m. UTC | #1
On 10/16/2012 02:31 AM, Mark Zhang wrote:
> Change the type of variable from "unsigned long" to "u64".
> This avoids the overflow while clock rate calculating.

Thanks, applied to Tegra's for-3.7/fixes-for-rc2 branch.

Prashant, this same bug was found before in another round_rate() or
similar function, and I'd asked you to audit the entire Tegra clock
driver for any similar issues. Could you (and/or Mark) please take
another look at the entire driver to make sure we don't keep finding
this issue clock-by-clock. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c
index 5cd502c..e9de5df 100644
--- a/arch/arm/mach-tegra/tegra30_clocks.c
+++ b/arch/arm/mach-tegra/tegra30_clocks.c
@@ -1199,7 +1199,7 @@  static long tegra30_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 {
 	struct clk_tegra *c = to_clk_tegra(hw);
 	unsigned long input_rate = *prate;
-	unsigned long output_rate = *prate;
+	u64 output_rate = *prate;
 	const struct clk_pll_freq_table *sel;
 	struct clk_pll_freq_table cfg;
 	int mul;