diff options
author | Dan Carpenter <error27@gmail.com> | 2010-04-07 13:22:58 +0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-04-20 04:17:13 +0400 |
commit | 42df64b1f83fa9b786067a0b5a3aca0fbb2d8db8 (patch) | |
tree | a0692e8bb1951a87849f03a9b04a853a8732ff17 /drivers/i2c | |
parent | 28ad3321a1ac732c7fe37d5be85f67fe40ef18a9 (diff) | |
download | linux-42df64b1f83fa9b786067a0b5a3aca0fbb2d8db8.tar.xz |
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: Dan Carpenter <error27@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-stu300.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 1f5b38be73bc..495be451d326 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c @@ -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++; |