* [patch] i2c: off by one issue
@ 2010-04-07 9:22 Dan Carpenter
2010-04-07 12:53 ` Linus WALLEIJ
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-04-07 9:22 UTC (permalink / raw)
To: Jean Delvare (PC drivers, core)
Cc: Ben Dooks (embedded platforms), Linus Walleij, Jean Delvare,
Tejun Heo, Christoph Lameter, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
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>
---
I will be offline for a while, sorry if I delay replying.
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 1f5b38b..495be45 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++;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [patch] i2c: off by one issue
2010-04-07 9:22 [patch] i2c: off by one issue Dan Carpenter
@ 2010-04-07 12:53 ` Linus WALLEIJ
0 siblings, 0 replies; 2+ messages in thread
From: Linus WALLEIJ @ 2010-04-07 12:53 UTC (permalink / raw)
To: Dan Carpenter, Jean Delvare (PC drivers, core)
Cc: Ben Dooks (embedded platforms), Jean Delvare, Tejun Heo,
Christoph Lameter,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> If we don't find the correct rate, we want to end the loop with "i"
> pointing to the last element in the array.
Good catch!
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-07 12:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-07 9:22 [patch] i2c: off by one issue Dan Carpenter
2010-04-07 12:53 ` Linus WALLEIJ
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox