From 1b2d4ad585d5bfb57603aed08e8fab99069e16e7 Mon Sep 17 00:00:00 2001 From: Deepak Sikri Date: Sat, 10 Nov 2012 12:13:46 +0530 Subject: [PATCH] CLK: SPEAr: Correct index scanning done for clock synths The patch corrects the case when the rate table is being scanned for a given frequency, and the search frequency is beyond the maximum frequency indexed in the table. By default, the system should be set at max frequency present in the rate table. This patch correctly returns the corresponding index value. Signed-off-by: Deepak Sikri Signed-off-by: Viresh Kumar Signed-off-by: Mike Turquette --- drivers/clk/spear/clk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/spear/clk.c b/drivers/clk/spear/clk.c index 7cd63788d546..628b6d5ed3d9 100644 --- a/drivers/clk/spear/clk.c +++ b/drivers/clk/spear/clk.c @@ -32,5 +32,8 @@ long clk_round_rate_index(struct clk_hw *hw, unsigned long drate, } } + if ((*index) == rtbl_cnt) + (*index)--; + return rate; } -- GitLab