Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42df64b1 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ben Dooks
Browse files

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: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 28ad3321
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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++;