Commit 0e0ed536 authored by Christos Gentsos's avatar Christos Gentsos

Master: fill data with 0xFF on failed I2C transactions

Previously, a failed I2C transaction would leave the data buffer
intact, and if one didn't look at the return status they might assume
valid data were returned. This modification should make it easier to
identify failed transactions.
parent e00dde5b
......@@ -396,6 +396,7 @@ int32_t i2c_m_sync_my_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t
if (ret != 0) {
/* error occurred */
memset(buffer, 0xFF, length);
return ret;
}
......@@ -417,6 +418,7 @@ int32_t i2c_m_sync_my_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t
/* error occurred */
if (use_pec)
free(pec_buf);
memset(buffer, 0xFF, length);
return ret;
}
......@@ -567,6 +569,7 @@ int32_t i2c_m_sync_ext_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_
if (ret != 0) {
/* error occurred */
memset(buffer, 0xFF, length);
return ret;
}
......@@ -588,6 +591,7 @@ int32_t i2c_m_sync_ext_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_
/* error occurred */
if (use_pec)
free(pec_buf);
memset(buffer, 0xFF, length);
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment