Skip to content

Commit 5ff5003

Browse files
saschahauerabelvesa
authored andcommitted
clk: imx: pll14xx: explicitly return lowest rate
clk_pll14xx_round_rate() returns the lowest rate by indexing into the rate table with the variable i. i is actually pll->rate_count as this is the value we come out of the loop with. Use pll->rate_count explicitly to make it a bit more clear what is being done. While at it fix a typo in the comment. No functional change. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Abel Vesa <abel.vesa@nxp.com> Link: https://lore.kernel.org/r/20220304125256.2125023-7-s.hauer@pengutronix.de Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
1 parent 052d03a commit 5ff5003

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/clk/imx/clk-pll14xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ static long clk_pll14xx_round_rate(struct clk_hw *hw, unsigned long rate,
118118
const struct imx_pll14xx_rate_table *rate_table = pll->rate_table;
119119
int i;
120120

121-
/* Assumming rate_table is in descending order */
121+
/* Assuming rate_table is in descending order */
122122
for (i = 0; i < pll->rate_count; i++)
123123
if (rate >= rate_table[i].rate)
124124
return rate_table[i].rate;
125125

126126
/* return minimum supported value */
127-
return rate_table[i - 1].rate;
127+
return rate_table[pll->rate_count - 1].rate;
128128
}
129129

130130
static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw,

0 commit comments

Comments
 (0)