nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] patacongo commented on a change in pull request #719: Kinetis lpc sdcard
Date Sat, 04 Apr 2020 01:35:30 GMT
patacongo commented on a change in pull request #719: Kinetis lpc sdcard
URL: https://github.com/apache/incubator-nuttx/pull/719#discussion_r403405854
 
 

 ##########
 File path: arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.c
 ##########
 @@ -2290,32 +2338,44 @@ static sdio_eventset_t lpc17_40_eventwait(FAR struct sdio_dev_s *dev,
       /* Start the watchdog timer */
 
       delay = MSEC2TICK(timeout);
-      ret   = wd_start(priv->waitwdog, delay, (wdentry_t)lpc17_40_eventtimeout,
+      ret   = wd_start(priv->waitwdog, delay,
+                       (wdentry_t) lpc17_40_eventtimeout,
                        1, (uint32_t)priv);
       if (ret < 0)
         {
           mcerr("ERROR: wd_start failed: %d\n", ret);
         }
     }
 
-  /* Loop until the event (or the timeout occurs). Race conditions are avoided
-   * by calling lpc17_40_waitenable prior to triggering the logic that will cause
-   * the wait to terminate.  Under certain race conditions, the waited-for
-   * may have already occurred before this function was called!
+  /* Loop until the event (or the timeout occurs). Race conditions are
+   * avoided by calling lpc17_40_waitenable prior to triggering the logic
+   * that will cause the wait to terminate.  Under certain race conditions,
+   * the waited-for may have already occurred before this function was
+   * called!
    */
 
   for (; ; )
     {
-      /* Wait for an event in event set to occur.  If this the event has already
-       * occurred, then the semaphore will already have been incremented and
-       * there will be no wait.
+      /* Wait for an event in event set to occur.  If this the event has
+       * already occurred, then the semaphore will already have been
+       * incremented and there will be no wait.
        */
 
-      lpc17_40_takesem(priv);
+      ret = lpc17_40_takesem(priv);
+      if (ret < 0)
+        {
+          wd_cancel(priv->waitwdog);
+
+          leave_critical_section(flags);
+
+          return SDIOWAIT_ERROR;
+        }
+
       wkupevent = priv->wkupevent;
 
 Review comment:
   LGTM

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message