summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/it83xx/i2c.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/chip/it83xx/i2c.c b/chip/it83xx/i2c.c
index 1160b1bd2c..0ab872f323 100644
--- a/chip/it83xx/i2c.c
+++ b/chip/it83xx/i2c.c
@@ -670,10 +670,16 @@ int chip_i2c_xfer(int port, uint16_t slave_addr_flags,
/* Make sure we're in a good state to start */
if ((flags & I2C_XFER_START) && (i2c_is_busy(port)
|| (i2c_get_line_levels(port) != I2C_LINE_IDLE))) {
+
/* Attempt to unwedge the port. */
- i2c_unwedge(port);
+ pd->err = i2c_unwedge(port);
+
/* reset i2c port */
i2c_reset(port, I2C_RC_NO_IDLE_FOR_START);
+
+ /* Return if port is still wedged */
+ if (pd->err)
+ return pd->err;
}
pd->task_waiting = task_get_current();