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:
jiangtao16
2025-08-22 15:38:38 +08:00
committed by Xiang Xiao
parent 51bb9e0417
commit caafba07bc
4 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -303,7 +303,7 @@
# define SIG_HOLD ((_sa_handler_t)1) /* Used only with sigset() */ # define SIG_HOLD ((_sa_handler_t)1) /* Used only with sigset() */
#endif #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 UNCAUGHT_SIGNO(s) ((s) == SIGKILL || (s) == SIGSTOP)
#define tkill(tid, signo) tgkill((pid_t)-1, tid, signo) #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 typedef struct sigevent
{ {
uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL, SIGEV_NONE, or SIGEV_THREAD */ int sigev_notify; /* Notification method: SIGEV_SIGNAL, SIGEV_NONE, or SIGEV_THREAD */
uint8_t sigev_signo; /* Notification signal */ int sigev_signo; /* Notification signal */
union sigval sigev_value; /* Data passed with notification */ union sigval sigev_value; /* Data passed with notification */
union union
+1 -1
View File
@@ -43,7 +43,7 @@
* Pre-processor Definitions * 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 * Public Types
+3 -3
View File
@@ -81,7 +81,7 @@ static FAR struct posix_timer_s *timer_allocate(void)
ret = (FAR struct posix_timer_s *) ret = (FAR struct posix_timer_s *)
kmm_malloc(sizeof(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 */ /* 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 */ /* Initialize the timer instance */
ret->pt_clock = clockid; ret->pt_clock = clockid;
ret->pt_crefs = 1; ret->pt_crefs = 1u;
ret->pt_owner = tcb->pid; ret->pt_owner = tcb->pid;
ret->pt_delay = 0; ret->pt_delay = 0;
ret->pt_expected = 0; ret->pt_expected = 0u;
/* Was a struct sigevent provided? */ /* Was a struct sigevent provided? */
+2 -2
View File
@@ -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 */ /* Return it to the free list if it is one of the preallocated timers */
#if CONFIG_PREALLOC_TIMERS > 0 #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); sq_addlast((FAR sq_entry_t *)timer, (FAR sq_queue_t *)&g_freetimers);
spin_unlock_irqrestore(&g_locktimers, flags); spin_unlock_irqrestore(&g_locktimers, flags);
@@ -118,7 +118,7 @@ int timer_release(FAR struct posix_timer_s *timer)
* would decrement to zero. * would decrement to zero.
*/ */
else if (timer->pt_crefs > 1) else if (timer->pt_crefs > 1u)
{ {
timer->pt_crefs--; timer->pt_crefs--;
ret = 1; ret = 1;