Skip to content

Commit

Permalink
i2c-stu300: off by one issue
Browse files Browse the repository at this point in the history
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: Dan Carpenter <error27@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Dan Carpenter authored and Ben Dooks committed Apr 20, 2010
1 parent 28ad332 commit 42df64b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-stu300.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;

Expand Down

0 comments on commit 42df64b

Please sign in to comment.