spi_xx25xx: in write operation return the number of bytes written not the result of ee25xx_semtake

This commit is contained in:
Alexander Vasiljev 2020-09-25 12:24:05 +03:00 committed by Xiang Xiao
parent b54e9ffccc
commit 834e584169

View File

@ -730,18 +730,18 @@ static ssize_t ee25xx_write(FAR struct file *filep, FAR const char *buffer,
len = eedev->size - filep->f_pos; len = eedev->size - filep->f_pos;
} }
/* From this point no failure cannot be detected anymore.
* The user should verify the write by rereading memory.
*/
ret = len; /* save number of bytes written */
ret = ee25xx_semtake(eedev); ret = ee25xx_semtake(eedev);
if (ret < 0) if (ret < 0)
{ {
return ret; return ret;
} }
/* From this point no failure cannot be detected anymore.
* The user should verify the write by rereading memory.
*/
ret = len; /* save number of bytes written */
/* Writes can't happen in a row like the read does. /* Writes can't happen in a row like the read does.
* The EEPROM is made of pages, and write sequences * The EEPROM is made of pages, and write sequences
* cannot cross page boundaries. So every time the last * cannot cross page boundaries. So every time the last