i2c: synquacer: fix fence-post error in retry loop

Message ID 20180509194726.29166-1-peda@axentia.se
State Accepted
Headers show
Series
  • i2c: synquacer: fix fence-post error in retry loop
Related show

Commit Message

Peter Rosin May 9, 2018, 7:47 p.m.
There is a difference between attempts and retries.

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/i2c/busses/i2c-synquacer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ard Biesheuvel May 14, 2018, 10:35 a.m. | #1
On 9 May 2018 at 21:47, Peter Rosin <peda@axentia.se> wrote:
> There is a difference between attempts and retries.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  drivers/i2c/busses/i2c-synquacer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
> index a021f866d8c2..915f5edbab33 100644
> --- a/drivers/i2c/busses/i2c-synquacer.c
> +++ b/drivers/i2c/busses/i2c-synquacer.c
> @@ -509,7 +509,7 @@ static int synquacer_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>
>         dev_dbg(i2c->dev, "calculated timeout %d ms\n", i2c->timeout_ms);
>
> -       for (retry = 0; retry < adap->retries; retry++) {
> +       for (retry = 0; retry <= adap->retries; retry++) {
>                 ret = synquacer_i2c_doxfer(i2c, msgs, num);
>                 if (ret != -EAGAIN)
>                         return ret;
> --
> 2.11.0
>
Wolfram Sang May 17, 2018, 1:41 p.m. | #2
On Wed, May 09, 2018 at 09:47:26PM +0200, Peter Rosin wrote:
> There is a difference between attempts and retries.
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>

Applied to for-next, thanks!

Patch

diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
index a021f866d8c2..915f5edbab33 100644
--- a/drivers/i2c/busses/i2c-synquacer.c
+++ b/drivers/i2c/busses/i2c-synquacer.c
@@ -509,7 +509,7 @@  static int synquacer_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 
 	dev_dbg(i2c->dev, "calculated timeout %d ms\n", i2c->timeout_ms);
 
-	for (retry = 0; retry < adap->retries; retry++) {
+	for (retry = 0; retry <= adap->retries; retry++) {
 		ret = synquacer_i2c_doxfer(i2c, msgs, num);
 		if (ret != -EAGAIN)
 			return ret;