sched/irq: Fix MISRA C-2012 Rule 10.4 - avoid implicit signed to unsigned cast

This patch fixes a Coverity issue where implicit casting from signed int to
unsigned int could lead to unexpected behavior. The fix replaces the implicit
cast with an explicit unsigned literal suffix to ensure type safety.

Changes:
- In irqchain_attach(): Changed comparison 'sq_count(&g_irqchainfreelist) < 2'
  to 'sq_count(&g_irqchainfreelist) < 2u' to use explicit unsigned literal

This ensures compliance with MISRA C-2012 Rule 10.4 which prohibits implicit
conversions between signed and unsigned types. This change prevents potential
integer conversion issues and improves code correctness.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
This commit is contained in:
pangzhen1
2025-08-25 22:19:41 +08:00
committed by Xiang Xiao
parent 048ef54c55
commit 02eaf3c973
+1 -1
View File
@@ -154,7 +154,7 @@ int irqchain_attach(int ndx, xcpt_t isr, FAR void *arg)
{
if (g_irqvector[ndx].handler != irqchain_dispatch)
{
if (sq_count(&g_irqchainfreelist) < 2)
if (sq_count(&g_irqchainfreelist) < 2u)
{
spin_unlock_irqrestore(&g_irqchainlock, flags);
return -ENOMEM;