nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx] branch master updated: Check the return of nxsem_wait_uninterruptible() This commit is for all bbsram drivers under arch/.
Date Sat, 04 Apr 2020 21:37:21 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt 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 dc96287   Check the return of nxsem_wait_uninterruptible() This commit is for all
bbsram drivers under arch/.
dc96287 is described below

commit dc96287d2759085aa06e2806151962b1af306da2
Author: Ouss4 <abdelatif.guettouche@gmail.com>
AuthorDate: Sat Apr 4 22:39:21 2020 +0100

     Check the return of nxsem_wait_uninterruptible()
    This commit is for all bbsram drivers under arch/.
---
 arch/arm/src/stm32/stm32_bbsram.c   | 91 ++++++++++++++++++++++++++-----------
 arch/arm/src/stm32f7/stm32_bbsram.c | 82 +++++++++++++++++++++++----------
 arch/arm/src/stm32h7/stm32_bbsram.c | 78 ++++++++++++++++++++++---------
 3 files changed, 180 insertions(+), 71 deletions(-)

diff --git a/arch/arm/src/stm32/stm32_bbsram.c b/arch/arm/src/stm32/stm32_bbsram.c
index 51c3888..0d6cc9d 100644
--- a/arch/arm/src/stm32/stm32_bbsram.c
+++ b/arch/arm/src/stm32/stm32_bbsram.c
@@ -131,8 +131,8 @@ static ssize_t stm32_bbsram_write(FAR struct file *filep,
                  FAR const char *buffer, size_t len);
 static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
                  unsigned long arg);
-static int     stm32_bbsram_poll(FAR struct file *filep, FAR struct pollfd *fds,
-                 bool setup);
+static int     stm32_bbsram_poll(FAR struct file *filep,
+                 FAR struct pollfd *fds, bool setup);
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int     stm32_bbsram_unlink(FAR struct inode *inode);
 #endif
@@ -164,6 +164,7 @@ static struct stm32_bbsram_s g_bbsram[CONFIG_STM32_BBSRAM_FILES];
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
+
 /****************************************************************************
  * Name: stm32_bbsram_rd
  ****************************************************************************/
@@ -195,16 +196,16 @@ static void stm32_bbsram_dump(FAR struct bbsramfh_s *bbf, char *op)
 }
 #endif
 
-/************************************************************************************
+/****************************************************************************
  * Name: stm32_bbsram_semgive
- ************************************************************************************/
+ ****************************************************************************/
 
 static void stm32_bbsram_semgive(FAR struct stm32_bbsram_s *priv)
 {
   nxsem_post(&priv->exclsem);
 }
 
-/************************************************************************************
+/****************************************************************************
  * Name: stm32_bbsram_semtake
  *
  * Description:
@@ -216,11 +217,11 @@ static void stm32_bbsram_semgive(FAR struct stm32_bbsram_s *priv)
  * Returned Value:
  *  None
  *
-****************************************************************************/
+ ****************************************************************************/
 
-static void stm32_bbsram_semtake(FAR struct stm32_bbsram_s *priv)
+static int stm32_bbsram_semtake(FAR struct stm32_bbsram_s *priv)
 {
-  nxsem_wait_uninterruptible(&priv->exclsem);
+  return nxsem_wait_uninterruptible(&priv->exclsem);
 }
 
 /****************************************************************************
@@ -279,7 +280,8 @@ static inline void stm32_bbsram_lock(void)
 
 static uint32_t stm32_bbsram_crc(FAR struct bbsramfh_s *pf)
 {
-  return crc32((uint8_t *)pf + BBSRAM_CRCED_OFFSET, BBSRAM_CRCED_SIZE(pf->len));
+  return crc32((uint8_t *)pf + BBSRAM_CRCED_OFFSET,
+               BBSRAM_CRCED_SIZE(pf->len));
 }
 
 /****************************************************************************
@@ -293,13 +295,19 @@ static int stm32_bbsram_open(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
   /* Increment the reference count */
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   if (bbr->refs == MAX_OPENCNT)
     {
       return -EMFILE;
@@ -347,7 +355,11 @@ static int stm32_bbsram_close(FAR struct file *filep)
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
 
   BBSRAM_DUMP(bbr->bbf, "close");
 
@@ -391,7 +403,11 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return (off_t)ret;
+    }
 
   /* Determine the new, requested file position */
 
@@ -410,6 +426,7 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
       break;
 
     default:
+
       /* Return EINVAL if the whence argument is invalid */
 
       stm32_bbsram_semgive(bbr);
@@ -418,15 +435,14 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
 
   /* Opengroup.org:
    *
-   *  "The lseek() function shall allow the file offset to be set beyond the end
-   *   of the existing data in the file. If data is later written at this point,
-   *   subsequent reads of data in the gap shall return bytes with the value 0
-   *   until data is actually written into the gap."
+   *  "The lseek() function shall allow the file offset to be set beyond the
+   *   end of the existing data in the file. If data is later written at this
+   *   point, subsequent reads of data in the gap shall return bytes with the
+   *   value 0 until data is actually written into the gap."
    *
-   * We can conform to the first part, but not the second.  But return EINVAL if
-   *
-   *  "...the resulting file offset would be negative for a regular file, block
-   *   special file, or directory."
+   * We can conform to the first part, but not the second.  But return EINVAL
+   * if "...the resulting file offset would be negative for a regular file,
+   *     block special file, or directory."
    */
 
   if (newpos >= 0)
@@ -452,11 +468,16 @@ static ssize_t stm32_bbsram_read(FAR struct file *filep, FAR char *buffer,
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return (ssize_t)ret;
+    }
 
   /* Trim len if read would go beyond end of device */
 
@@ -488,8 +509,8 @@ static ssize_t stm32_bbsram_internal_write(FAR struct bbsramfh_s *bbf,
  * Name: stm32_bbsram_write
  ****************************************************************************/
 
-static ssize_t stm32_bbsram_write(FAR struct file *filep, FAR const char *buffer,
-                                  size_t len)
+static ssize_t stm32_bbsram_write(FAR struct file *filep,
+                                  FAR const char *buffer, size_t len)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
@@ -509,9 +530,14 @@ static ssize_t stm32_bbsram_write(FAR struct file *filep, FAR const char
*buffer
           len = bbr->bbf->len - filep->f_pos;
         }
 
+      ret = stm32_bbsram_semtake(bbr);
+      if (ret < 0)
+        {
+          return (ssize_t)ret;
+        }
+
       ret = len; /* save number of bytes written */
 
-      stm32_bbsram_semtake(bbr);
       BBSRAM_DUMP(bbr->bbf, "write");
       stm32_bbsram_unlock();
       stm32_bbsram_internal_write(bbr->bbf, buffer, filep->f_pos, len);
@@ -565,7 +591,12 @@ static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
     {
       FAR struct bbsramd_s *bbrr = (FAR struct bbsramd_s *)((uintptr_t)arg);
 
-      stm32_bbsram_semtake(bbr);
+      ret = stm32_bbsram_semtake(bbr);
+      if (ret < 0)
+        {
+          return ret;
+        }
+
       if (!bbrr)
         {
           ret = -EINVAL;
@@ -604,11 +635,17 @@ static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
 static int stm32_bbsram_unlink(FAR struct inode *inode)
 {
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   stm32_bbsram_unlock();
   memset(bbr->bbf->data, 0, bbr->bbf->len);
   bbr->bbf->lastwrite.tv_nsec = 0;
@@ -618,6 +655,7 @@ static int stm32_bbsram_unlink(FAR struct inode *inode)
   bbr->refs  = 0;
   stm32_bbsram_semgive(bbr);
   nxsem_destroy(&bbr->exclsem);
+
   return 0;
 }
 #endif
@@ -668,7 +706,6 @@ static int stm32_bbsram_probe(int *ent, struct stm32_bbsram_s pdev[])
               pf->fileno != i ||
               pf->crc != stm32_bbsram_crc(pf))
             {
-
               /* Not Valid so wipe the file in BBSRAM */
 
               memset((uint8_t *)pf, 0, alloc);
diff --git a/arch/arm/src/stm32f7/stm32_bbsram.c b/arch/arm/src/stm32f7/stm32_bbsram.c
index 81cb853..5225197 100644
--- a/arch/arm/src/stm32f7/stm32_bbsram.c
+++ b/arch/arm/src/stm32f7/stm32_bbsram.c
@@ -131,8 +131,8 @@ static ssize_t stm32_bbsram_write(FAR struct file *filep,
                  FAR const char *buffer, size_t len);
 static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
                  unsigned long arg);
-static int     stm32_bbsram_poll(FAR struct file *filep, FAR struct pollfd *fds,
-                 bool setup);
+static int     stm32_bbsram_poll(FAR struct file *filep,
+                 FAR struct pollfd *fds, bool setup);
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int     stm32_bbsram_unlink(FAR struct inode *inode);
 #endif
@@ -217,11 +217,11 @@ static void stm32_bbsram_semgive(FAR struct stm32_bbsram_s *priv)
  * Returned Value:
  *  None
  *
-****************************************************************************/
+ ****************************************************************************/
 
-static void stm32_bbsram_semtake(FAR struct stm32_bbsram_s *priv)
+static int stm32_bbsram_semtake(FAR struct stm32_bbsram_s *priv)
 {
-  nxsem_wait_uninterruptible(&priv->exclsem);
+  return nxsem_wait_uninterruptible(&priv->exclsem);
 }
 
 /****************************************************************************
@@ -280,7 +280,8 @@ static inline void stm32_bbsram_lock(void)
 
 static uint32_t stm32_bbsram_crc(FAR struct bbsramfh_s *pf)
 {
-  return crc32((uint8_t *)pf + BBSRAM_CRCED_OFFSET, BBSRAM_CRCED_SIZE(pf->len));
+  return crc32((uint8_t *)pf + BBSRAM_CRCED_OFFSET,
+               BBSRAM_CRCED_SIZE(pf->len));
 }
 
 /****************************************************************************
@@ -294,13 +295,19 @@ static int stm32_bbsram_open(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
   /* Increment the reference count */
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   if (bbr->refs == MAX_OPENCNT)
     {
       return -EMFILE;
@@ -348,7 +355,11 @@ static int stm32_bbsram_close(FAR struct file *filep)
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
 
   BBSRAM_DUMP(bbr->bbf, "close");
 
@@ -392,7 +403,11 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return (off_t)ret;
+    }
 
   /* Determine the new, requested file position */
 
@@ -411,6 +426,7 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
       break;
 
     default:
+
       /* Return EINVAL if the whence argument is invalid */
 
       stm32_bbsram_semgive(bbr);
@@ -419,15 +435,14 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
 
   /* Opengroup.org:
    *
-   *  "The lseek() function shall allow the file offset to be set beyond the end
-   *   of the existing data in the file. If data is later written at this point,
-   *   subsequent reads of data in the gap shall return bytes with the value 0
-   *   until data is actually written into the gap."
+   *  "The lseek() function shall allow the file offset to be set beyond the
+   *   end of the existing data in the file. If data is later written at this
+   *   point, subsequent reads of data in the gap shall return bytes with the
+   *   value 0 until data is actually written into the gap."
    *
-   * We can conform to the first part, but not the second.  But return EINVAL if
-   *
-   *  "...the resulting file offset would be negative for a regular file, block
-   *   special file, or directory."
+   * We can conform to the first part, but not the second.  But return EINVAL
+   * if "...the resulting file offset would be negative for a regular file,
+   *     block special file, or directory."
    */
 
   if (newpos >= 0)
@@ -453,11 +468,16 @@ static ssize_t stm32_bbsram_read(FAR struct file *filep, FAR char *buffer,
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return (ssize_t)ret;
+    }
 
   /* Trim len if read would go beyond end of device */
 
@@ -510,9 +530,14 @@ static ssize_t stm32_bbsram_write(FAR struct file *filep,
           len = bbr->bbf->len - filep->f_pos;
         }
 
+      ret = stm32_bbsram_semtake(bbr);
+      if (ret < 0)
+        {
+          return (ssize_t)ret;
+        }
+
       ret = len; /* save number of bytes written */
 
-      stm32_bbsram_semtake(bbr);
       BBSRAM_DUMP(bbr->bbf, "write");
       stm32_bbsram_unlock();
       stm32_bbsram_internal_write(bbr->bbf, buffer, filep->f_pos, len);
@@ -566,7 +591,12 @@ static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
     {
       FAR struct bbsramd_s *bbrr = (FAR struct bbsramd_s *)((uintptr_t)arg);
 
-      stm32_bbsram_semtake(bbr);
+      ret = stm32_bbsram_semtake(bbr);
+      if (ret < 0)
+        {
+          return ret;
+        }
+
       if (!bbrr)
         {
           ret = -EINVAL;
@@ -605,11 +635,17 @@ static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
 static int stm32_bbsram_unlink(FAR struct inode *inode)
 {
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   stm32_bbsram_unlock();
   memset(bbr->bbf->data, 0, bbr->bbf->len);
   bbr->bbf->lastwrite.tv_nsec = 0;
@@ -640,7 +676,8 @@ static int stm32_bbsram_probe(int *ent, struct stm32_bbsram_s pdev[])
   int ret = -EFBIG;
   struct bbsramfh_s *pf = (struct bbsramfh_s *) STM32_BKPSRAM_BASE;
 
-  for (i = 0; (i < CONFIG_STM32F7_BBSRAM_FILES) && ent[i] && (avail >
0); i++)
+  for (i = 0; (i < CONFIG_STM32F7_BBSRAM_FILES) && ent[i] && (avail >
0);
+       i++)
     {
       /* Validate the actual allocations against what is in the BBSRAM */
 
@@ -669,7 +706,6 @@ static int stm32_bbsram_probe(int *ent, struct stm32_bbsram_s pdev[])
               pf->fileno != i ||
               pf->crc != stm32_bbsram_crc(pf))
             {
-
               /* Not Valid so wipe the file in BBSRAM */
 
               memset((uint8_t *)pf, 0, alloc);
diff --git a/arch/arm/src/stm32h7/stm32_bbsram.c b/arch/arm/src/stm32h7/stm32_bbsram.c
index 5438a84..d0c406a 100644
--- a/arch/arm/src/stm32h7/stm32_bbsram.c
+++ b/arch/arm/src/stm32h7/stm32_bbsram.c
@@ -152,8 +152,8 @@ static ssize_t stm32_bbsram_write(FAR struct file *filep,
                  FAR const char *buffer, size_t len);
 static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
                  unsigned long arg);
-static int     stm32_bbsram_poll(FAR struct file *filep, FAR struct pollfd *fds,
-                 bool setup);
+static int     stm32_bbsram_poll(FAR struct file *filep,
+                 FAR struct pollfd *fds, bool setup);
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int     stm32_bbsram_unlink(FAR struct inode *inode);
 #endif
@@ -240,9 +240,9 @@ static void stm32_bbsram_semgive(FAR struct stm32_bbsram_s *priv)
  *
  ****************************************************************************/
 
-static void stm32_bbsram_semtake(FAR struct stm32_bbsram_s *priv)
+static int stm32_bbsram_semtake(FAR struct stm32_bbsram_s *priv)
 {
-  nxsem_wait_uninterruptible(&priv->exclsem);
+  return nxsem_wait_uninterruptible(&priv->exclsem);
 }
 
 /****************************************************************************
@@ -301,7 +301,8 @@ static inline void stm32_bbsram_lock(void)
 
 static uint32_t stm32_bbsram_crc(FAR struct bbsramfh_s *pf)
 {
-  return crc32((uint8_t *)pf + BBSRAM_CRCED_OFFSET, BBSRAM_CRCED_SIZE(pf->len));
+  return crc32((uint8_t *)pf + BBSRAM_CRCED_OFFSET,
+               BBSRAM_CRCED_SIZE(pf->len));
 }
 
 /****************************************************************************
@@ -340,13 +341,19 @@ static int stm32_bbsram_open(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
   /* Increment the reference count */
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   if (bbr->refs == MAX_OPENCNT)
     {
       return -EMFILE;
@@ -394,7 +401,11 @@ static int stm32_bbsram_close(FAR struct file *filep)
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
 
   BBSRAM_DUMP(bbr->bbf, "close");
 
@@ -438,7 +449,11 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return (off_t)ret;
+    }
 
   /* Determine the new, requested file position */
 
@@ -466,15 +481,14 @@ static off_t stm32_bbsram_seek(FAR struct file *filep, off_t offset,
 
   /* Opengroup.org:
    *
-   *  "The lseek() function shall allow the file offset to be set beyond the end
-   *   of the existing data in the file. If data is later written at this point,
-   *   subsequent reads of data in the gap shall return bytes with the value 0
-   *   until data is actually written into the gap."
-   *
-   * We can conform to the first part, but not the second.  But return EINVAL if
+   *  "The lseek() function shall allow the file offset to be set beyond the
+   *   end of the existing data in the file. If data is later written at this
+   *   point, subsequent reads of data in the gap shall return bytes with the
+   *   value 0 until data is actually written into the gap."
    *
-   *  "...the resulting file offset would be negative for a regular file, block
-   *   special file, or directory."
+   * We can conform to the first part, but not the second.  But return EINVAL
+   * if "...the resulting file offset would be negative for a regular file,
+   *     block special file, or directory."
    */
 
   if (newpos >= 0)
@@ -500,11 +514,16 @@ static ssize_t stm32_bbsram_read(FAR struct file *filep, FAR char *buffer,
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return (ssize_t)ret;
+    }
 
   /* Trim len if read would go beyond end of device */
 
@@ -558,9 +577,14 @@ static ssize_t stm32_bbsram_write(FAR struct file *filep,
           len = bbr->bbf->len - filep->f_pos;
         }
 
+      ret = stm32_bbsram_semtake(bbr);
+      if (ret < 0)
+        {
+          return (ssize_t)ret;
+        }
+
       ret = len; /* save number of bytes written */
 
-      stm32_bbsram_semtake(bbr);
       BBSRAM_DUMP(bbr->bbf, "write");
       stm32_bbsram_unlock();
       stm32_bbsram_internal_write(bbr->bbf, buffer, filep->f_pos, len);
@@ -614,7 +638,12 @@ static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
     {
       FAR struct bbsramd_s *bbrr = (FAR struct bbsramd_s *)((uintptr_t)arg);
 
-      stm32_bbsram_semtake(bbr);
+      ret = stm32_bbsram_semtake(bbr);
+      if (ret < 0)
+        {
+          return ret;
+        }
+
       if (!bbrr)
         {
           ret = -EINVAL;
@@ -653,11 +682,17 @@ static int stm32_bbsram_ioctl(FAR struct file *filep, int cmd,
 static int stm32_bbsram_unlink(FAR struct inode *inode)
 {
   FAR struct stm32_bbsram_s *bbr;
+  int ret;
 
   DEBUGASSERT(inode && inode->i_private);
   bbr = (FAR struct stm32_bbsram_s *)inode->i_private;
 
-  stm32_bbsram_semtake(bbr);
+  ret = stm32_bbsram_semtake(bbr);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
   stm32_bbsram_unlock();
   memset(bbr->bbf->data, 0, bbr->bbf->len);
   bbr->bbf->lastwrite.tv_nsec = 0;
@@ -698,7 +733,8 @@ static int stm32_bbsram_probe(int *ent, struct stm32_bbsram_s pdev[])
 
   avail = STM32H7_BBSRAM_SIZE;
 
-  for (i = 0; (i < CONFIG_STM32H7_BBSRAM_FILES) && ent[i] && (avail >
0); i++)
+  for (i = 0; (i < CONFIG_STM32H7_BBSRAM_FILES) && ent[i] && (avail >
0);
+       i++)
     {
       /* Validate the actual allocations against what is in the BBSRAM */
 


Mime
View raw message