drivers: i2c_nrfx_twim: clean up when buffer capacity failure detected

Do the normal post-transfer shutdown and sync management when a
transaction is rejected due to insufficient buffer size rather than
returning with the peripheral left enabled and the transfer lock held.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-08-19 13:05:21 -05:00 committed by Maureen Helm
commit 1278c13d47

View file

@ -78,7 +78,8 @@ static int i2c_nrfx_twim_transfer(struct device *dev, struct i2c_msg *msgs,
if ((concat_len + msgs[i].len) > concat_buf_size) { if ((concat_len + msgs[i].len) > concat_buf_size) {
LOG_ERR("concat-buf overflow: %u + %u > %u", LOG_ERR("concat-buf overflow: %u + %u > %u",
concat_len, msgs[i].len, concat_buf_size); concat_len, msgs[i].len, concat_buf_size);
return -ENOSPC; ret = -ENOSPC;
break;
} }
if (!(msgs[i].flags & I2C_MSG_READ)) { if (!(msgs[i].flags & I2C_MSG_READ)) {
memcpy(concat_buf + concat_len, memcpy(concat_buf + concat_len,