You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/05/16 07:20:58 UTC

[incubator-nuttx] branch master updated (d3524d4f8b -> 1c977e97d2)

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

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


    from d3524d4f8b arch/i2c: Change xxx_i2c_tousecs to xxx_i2c_toticks
     new 3bac0d8367 timer:settime: check return value of clock_abstime2ticks
     new 1c977e97d2 pthread_mutexinit: fix deadcode in pthread_mutexinit

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 libs/libc/pthread/pthread_mutexattr_setrobust.c |  2 +-
 sched/pthread/pthread_mutexinit.c               | 11 ++++++-----
 sched/timer/timer_settime.c                     | 12 ++++++++++--
 3 files changed, 17 insertions(+), 8 deletions(-)


[incubator-nuttx] 01/02: timer:settime: check return value of clock_abstime2ticks

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3bac0d8367a48f1ac25b89493ea1bb5157457a9c
Author: zhuyanlin <zh...@xiaomi.com>
AuthorDate: Thu Apr 28 19:59:41 2022 +0800

    timer:settime: check return value of clock_abstime2ticks
    
    Signed-off-by: zhuyanlin <zh...@xiaomi.com>
---
 sched/timer/timer_settime.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c
index 780f4b51cb..7f0a398a9d 100644
--- a/sched/timer/timer_settime.c
+++ b/sched/timer/timer_settime.c
@@ -287,7 +287,7 @@ int timer_settime(timer_t timerid, int flags,
     {
       /* Calculate a delay corresponding to the absolute time in 'value' */
 
-      clock_abstime2ticks(timer->pt_clock, &value->it_value, &delay);
+      ret = clock_abstime2ticks(timer->pt_clock, &value->it_value, &delay);
     }
   else
     {
@@ -296,7 +296,14 @@ int timer_settime(timer_t timerid, int flags,
        * returns success.
        */
 
-      clock_time2ticks(&value->it_value, &delay);
+      ret = clock_time2ticks(&value->it_value, &delay);
+    }
+
+  if (ret < 0)
+    {
+      set_errno(-ret);
+      ret = ERROR;
+      goto errout;
     }
 
   /* If the time is in the past or now, then set up the next interval
@@ -324,6 +331,7 @@ int timer_settime(timer_t timerid, int flags,
         }
     }
 
+errout:
   leave_critical_section(intflags);
   return ret;
 }


[incubator-nuttx] 02/02: pthread_mutexinit: fix deadcode in pthread_mutexinit

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1c977e97d21b5b907f2d26c7220823374eb80b99
Author: zhuyanlin <zh...@xiaomi.com>
AuthorDate: Thu Apr 28 19:34:26 2022 +0800

    pthread_mutexinit: fix deadcode in pthread_mutexinit
    
    Signed-off-by: zhuyanlin <zh...@xiaomi.com>
---
 libs/libc/pthread/pthread_mutexattr_setrobust.c |  2 +-
 sched/pthread/pthread_mutexinit.c               | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libs/libc/pthread/pthread_mutexattr_setrobust.c b/libs/libc/pthread/pthread_mutexattr_setrobust.c
index 5367a15b3a..86dd7228cb 100644
--- a/libs/libc/pthread/pthread_mutexattr_setrobust.c
+++ b/libs/libc/pthread/pthread_mutexattr_setrobust.c
@@ -62,7 +62,7 @@ int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust)
 #elif defined(CONFIG_PTHREAD_MUTEX_BOTH)
 
   if (attr != NULL && (robust == PTHREAD_MUTEX_STALLED ||
-      robust == _PTHREAD_MFLAGS_ROBUST))
+      robust == PTHREAD_MUTEX_ROBUST))
     {
       attr->robust = robust;
       return OK;
diff --git a/sched/pthread/pthread_mutexinit.c b/sched/pthread/pthread_mutexinit.c
index 95da3f4685..c1956a09ec 100644
--- a/sched/pthread/pthread_mutexinit.c
+++ b/sched/pthread/pthread_mutexinit.c
@@ -69,9 +69,9 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
 #endif
 #ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
 #ifdef CONFIG_PTHREAD_MUTEX_DEFAULT_UNSAFE
-  uint8_t robust = PTHREAD_MUTEX_STALLED;
+  uint8_t flags = 0;
 #else
-  uint8_t robust = PTHREAD_MUTEX_ROBUST;
+  uint8_t flags = _PTHREAD_MFLAGS_ROBUST;
 #endif
 #endif
   int ret = OK;
@@ -97,7 +97,8 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
           type    = attr->type;
 #endif
 #ifdef CONFIG_PTHREAD_MUTEX_BOTH
-          robust  = attr->robust;
+          flags  = attr->robust == PTHREAD_MUTEX_ROBUST ?
+                   _PTHREAD_MFLAGS_ROBUST : 0;
 #endif
         }
 
@@ -127,8 +128,8 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
       /* Initial internal fields of the mutex */
 
       mutex->flink  = NULL;
-      mutex->flags  = (robust == PTHREAD_MUTEX_ROBUST ?
-                       _PTHREAD_MFLAGS_ROBUST : 0);
+
+      mutex->flags  = flags;
 #endif
 
 #ifdef CONFIG_PTHREAD_MUTEX_TYPES