aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh/clk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sh/clk.c')
-rw-r--r--drivers/sh/clk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/sh/clk.c b/drivers/sh/clk.c
index c76f972db69a..dae64ee9ecc5 100644
--- a/drivers/sh/clk.c
+++ b/drivers/sh/clk.c
@@ -82,7 +82,7 @@ struct clk_rate_round_data {
82 82
83#define for_each_frequency(pos, r, freq) \ 83#define for_each_frequency(pos, r, freq) \
84 for (pos = r->min, freq = r->func(pos, r); \ 84 for (pos = r->min, freq = r->func(pos, r); \
85 pos < r->max; pos++, freq = r->func(pos, r)) \ 85 pos <= r->max; pos++, freq = r->func(pos, r)) \
86 if (unlikely(freq == 0)) \ 86 if (unlikely(freq == 0)) \
87 ; \ 87 ; \
88 else 88 else
@@ -139,12 +139,15 @@ long clk_rate_table_round(struct clk *clk,
139{ 139{
140 struct clk_rate_round_data table_round = { 140 struct clk_rate_round_data table_round = {
141 .min = 0, 141 .min = 0,
142 .max = clk->nr_freqs, 142 .max = clk->nr_freqs - 1,
143 .func = clk_rate_table_iter, 143 .func = clk_rate_table_iter,
144 .arg = freq_table, 144 .arg = freq_table,
145 .rate = rate, 145 .rate = rate,
146 }; 146 };
147 147
148 if (clk->nr_freqs < 1)
149 return 0;
150
148 return clk_rate_round_helper(&table_round); 151 return clk_rate_round_helper(&table_round);
149} 152}
150 153