You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/09/25 11:51:34 UTC

[incubator-nuttx] branch master updated: spi_xx25xx: in write operation return the number of bytes written not the result of ee25xx_semtake

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 834e584  spi_xx25xx: in write operation return the number of bytes written not the result of ee25xx_semtake
834e584 is described below

commit 834e5841695aea418dfc9f941a3645cad6f8ab36
Author: Alexander Vasiljev <al...@gmail.com>
AuthorDate: Fri Sep 25 12:24:05 2020 +0300

    spi_xx25xx: in write operation return the number of bytes written not the result of ee25xx_semtake
---
 drivers/eeprom/spi_xx25xx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/eeprom/spi_xx25xx.c b/drivers/eeprom/spi_xx25xx.c
index f89c7b3..2595bdc 100644
--- a/drivers/eeprom/spi_xx25xx.c
+++ b/drivers/eeprom/spi_xx25xx.c
@@ -730,18 +730,18 @@ static ssize_t ee25xx_write(FAR struct file *filep, FAR const char *buffer,
       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);
   if (ret < 0)
     {
       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.
    * The EEPROM is made of pages, and write sequences
    * cannot cross page boundaries. So every time the last