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

Commit d10db3a0 authored by Roel Kluin's avatar Roel Kluin Committed by Ben Dooks
Browse files

i2c-pxa.c: timeouts off by 1



With `while (timeout--)' timeout reaches -1 after the loop, so the tests
below are off by one.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Acked-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 091438dd
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -265,10 +265,10 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
		show_state(i2c);
		show_state(i2c);
	}
	}


	if (timeout <= 0)
	if (timeout < 0)
		show_state(i2c);
		show_state(i2c);


	return timeout <= 0 ? I2C_RETRY : 0;
	return timeout < 0 ? I2C_RETRY : 0;
}
}


static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
@@ -612,7 +612,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
		show_state(i2c);
		show_state(i2c);
	}
	}


	if (timeout <= 0) {
	if (timeout < 0) {
		show_state(i2c);
		show_state(i2c);
		dev_err(&i2c->adap.dev,
		dev_err(&i2c->adap.dev,
			"i2c_pxa: timeout waiting for bus free\n");
			"i2c_pxa: timeout waiting for bus free\n");