mirror of
https://github.com/apache/nuttx.git
synced 2026-05-18 00:34:10 +08:00
sched/timer: Fix MISRA Rule 10.4
Fix MISRA Rule 10.4 convert signed variabled to unsigned ones. Signed-off-by: jiangtao16 <jiangtao16@xiaomi.com>
This commit is contained in:
+3
-3
@@ -303,7 +303,7 @@
|
||||
# define SIG_HOLD ((_sa_handler_t)1) /* Used only with sigset() */
|
||||
#endif
|
||||
|
||||
#define GOOD_SIGNO(s) (((unsigned)(s)) <= MAX_SIGNO)
|
||||
#define GOOD_SIGNO(s) (((unsigned)(s)) <= ((unsigned)(MAX_SIGNO)))
|
||||
#define UNCAUGHT_SIGNO(s) ((s) == SIGKILL || (s) == SIGSTOP)
|
||||
|
||||
#define tkill(tid, signo) tgkill((pid_t)-1, tid, signo)
|
||||
@@ -347,8 +347,8 @@ typedef CODE void (*sigev_notify_function_t)(union sigval value);
|
||||
|
||||
typedef struct sigevent
|
||||
{
|
||||
uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL, SIGEV_NONE, or SIGEV_THREAD */
|
||||
uint8_t sigev_signo; /* Notification signal */
|
||||
int sigev_notify; /* Notification method: SIGEV_SIGNAL, SIGEV_NONE, or SIGEV_THREAD */
|
||||
int sigev_signo; /* Notification signal */
|
||||
union sigval sigev_value; /* Data passed with notification */
|
||||
|
||||
union
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define PT_FLAGS_PREALLOCATED 0x01 /* Timer comes from a pool of preallocated timers */
|
||||
#define PT_FLAGS_PREALLOCATED 0x01u /* Timer comes from a pool of preallocated timers */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
||||
@@ -81,7 +81,7 @@ static FAR struct posix_timer_s *timer_allocate(void)
|
||||
|
||||
ret = (FAR struct posix_timer_s *)
|
||||
kmm_malloc(sizeof(struct posix_timer_s));
|
||||
pt_flags = 0;
|
||||
pt_flags = 0u;
|
||||
}
|
||||
|
||||
/* If we have a timer, then put it into the allocated timer list */
|
||||
@@ -184,10 +184,10 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp,
|
||||
/* Initialize the timer instance */
|
||||
|
||||
ret->pt_clock = clockid;
|
||||
ret->pt_crefs = 1;
|
||||
ret->pt_crefs = 1u;
|
||||
ret->pt_owner = tcb->pid;
|
||||
ret->pt_delay = 0;
|
||||
ret->pt_expected = 0;
|
||||
ret->pt_expected = 0u;
|
||||
|
||||
/* Was a struct sigevent provided? */
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ static inline void timer_free(struct posix_timer_s *timer)
|
||||
/* Return it to the free list if it is one of the preallocated timers */
|
||||
|
||||
#if CONFIG_PREALLOC_TIMERS > 0
|
||||
if ((timer->pt_flags & PT_FLAGS_PREALLOCATED) != 0)
|
||||
if ((timer->pt_flags & PT_FLAGS_PREALLOCATED) != 0u)
|
||||
{
|
||||
sq_addlast((FAR sq_entry_t *)timer, (FAR sq_queue_t *)&g_freetimers);
|
||||
spin_unlock_irqrestore(&g_locktimers, flags);
|
||||
@@ -118,7 +118,7 @@ int timer_release(FAR struct posix_timer_s *timer)
|
||||
* would decrement to zero.
|
||||
*/
|
||||
|
||||
else if (timer->pt_crefs > 1)
|
||||
else if (timer->pt_crefs > 1u)
|
||||
{
|
||||
timer->pt_crefs--;
|
||||
ret = 1;
|
||||
|
||||
Reference in New Issue
Block a user