aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorHeinrich Schuchardt2020-05-09 18:20:18 +0200
committerHeiko Schocher2020-05-28 05:52:46 +0200
commitda585c3c680add381662417b11cfc7d0ac310ba5 (patch)
treebc6aef5ae81511cba52577ff09f90b538cb62508 /drivers/i2c
parentf6f9a016899e62cb65016421a09fd3fe06ce660f (diff)
i2c: observe scl_count in i2c_deblock_gpio_loop()
When compiling with -Wtype-limits we see this error: drivers/i2c/i2c-uclass.c: In function ‘i2c_deblock_gpio_loop’: drivers/i2c/i2c-uclass.c:517:21: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] 517 | while (scl_count-- >= 0) { | Don't loop forever. Fixes: 1f746a2c82b1 ("i2c: Make deblock delay and SCL clock configurable") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index 8166df7ba63..8bc69e870fd 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -516,7 +516,7 @@ int i2c_deblock_gpio_loop(struct gpio_desc *sda_pin,
udelay(delay);
/* Toggle SCL until slave release SDA */
- while (scl_count-- >= 0) {
+ for (; scl_count; --scl_count) {
i2c_gpio_set_pin(scl_pin, 1);
udelay(delay);
i2c_gpio_set_pin(scl_pin, 0);