forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/clk/sprd/pll.c
....@@ -87,11 +87,12 @@
8787 {
8888 u32 i, num = table[0];
8989
90
- for (i = 1; i < num + 1; i++)
91
- if (rate <= table[i])
90
+ /* table[0] indicates the number of items in this table */
91
+ for (i = 0; i < num; i++)
92
+ if (rate <= table[i + 1])
9293 break;
9394
94
- return (i == num + 1) ? num : i;
95
+ return i == num ? num - 1 : i;
9596 }
9697
9798 static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,