Skip to contentSkip to conversation

MIPS: I2C: Return -ETIMEDOUT in octeon_i2c_wait() on timeout

PATCH In review Bernhard Walle 4 participants 4 messages Sep 27, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: I2C: Return -ETIMEDOUT in octeon_i2c_wait() on timeout

It doesn't make sense to set result to -ETIMEDOUT but return 0 (success) afterwards. Since there's code in octeon_i2c_start() to handle the error, it should be called.

---
 drivers/i2c/busses/i2c-octeon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-octeon.c +1 -1
index 0e9f85d..56dbe54 100644
@@ -218,7 +218,7 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)
 		return result;
 	} else if (result == 0) {
 		dev_dbg(i2c->dev, "%s: timeout\n", __func__);
-		result = -ETIMEDOUT;
+		return -ETIMEDOUT;
 	}
 
 	return 0;
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Bernhard Walle

It doesn't make sense to set result to -ETIMEDOUT but return 0 (success) afterwards. Since there's code in octeon_i2c_start() to handle the error, it should be called.

but next time you should cc Ben Dooks to pick it up (i2c for embedded).

Quoted 24 lines
---
 drivers/i2c/busses/i2c-octeon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-octeon.c +1 -1
index 0e9f85d..56dbe54 100644
@@ -218,7 +218,7 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)
 		return result;
 	} else if (result == 0) {
 		dev_dbg(i2c->dev, "%s: timeout\n", __func__);
-		result = -ETIMEDOUT;
+		return -ETIMEDOUT;
 	}
 
 	return 0;
Signature · 6 lines
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Acked-by on v1 1/1
#2 lore raw
In reply to Bernhard Walle
Quoted 5 lines · Bernhard Walle

It doesn't make sense to set result to -ETIMEDOUT but return 0 (success) afterwards. Since there's code in octeon_i2c_start() to handle the error, it should be called.

Thanks for fixing this.

Quoted 17 lines
---
  drivers/i2c/busses/i2c-octeon.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-octeon.c +1 -1
index 0e9f85d..56dbe54 100644
@@ -218,7 +218,7 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)
  		return result;
  	} else if (result == 0) {
  		dev_dbg(i2c->dev, "%s: timeout\n", __func__);
-		result = -ETIMEDOUT;
+		return -ETIMEDOUT;
  	}
 
  	return 0;
#3 lore raw
Quoted 10 lines · David Daney
Quoted 5 lines · Bernhard Walle

It doesn't make sense to set result to -ETIMEDOUT but return 0 (success) afterwards. Since there's code in octeon_i2c_start() to handle the error, it should be called.

Thanks for fixing this.

Ok, will put into my for -rc6 branch.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.