summaryrefslogtreecommitdiff
path: root/chip/npcx
diff options
context:
space:
mode:
Diffstat (limited to 'chip/npcx')
-rw-r--r--chip/npcx/i2c.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/chip/npcx/i2c.c b/chip/npcx/i2c.c
index bccdb3c084..16c85d4439 100644
--- a/chip/npcx/i2c.c
+++ b/chip/npcx/i2c.c
@@ -652,11 +652,14 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
p_status->oper_state != SMB_WRITE_SUSPEND &&
(i2c_bus_busy(ctrl)
|| (i2c_get_line_levels(port) != I2C_LINE_IDLE))) {
+ int ret;
- /* Attempt to unwedge the i2c port. */
- i2c_unwedge(port);
+ /* Attempt to unwedge the i2c port */
+ ret = i2c_unwedge(port);
+ if (ret)
+ return ret;
p_status->err_code = SMB_BUS_BUSY;
- /* recovery i2c controller */
+ /* recover i2c controller */
i2c_recovery(ctrl, p_status);
/* Select port again for recovery */
i2c_select_port(port);