提交 42df64b1 编写于 作者: D Dan Carpenter 提交者: Ben Dooks

i2c-stu300: off by one issue

If we don't find the correct rate, we want to end the loop with "i"
pointing to the last element in the array.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NBen Dooks <ben-linux@fluff.org>
上级 28ad3321
......@@ -498,7 +498,7 @@ static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate)
int i = 0;
/* Locate the apropriate clock setting */
while (i < ARRAY_SIZE(stu300_clktable) &&
while (i < ARRAY_SIZE(stu300_clktable) - 1 &&
stu300_clktable[i].rate < clkrate)
i++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册